Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > asp:BoundField and HtmlEncode

Reply
Thread Tools

asp:BoundField and HtmlEncode

 
 
jMehdi
Guest
Posts: n/a
 
      07-05-2007
I have the following definition:

<asp:BoundField DataField="ThreadPostAuthor" HeaderText="<%$
Resources:ForumsRes, StartedBy %>" SortExpression="ThreadPostAuthor"
HtmlEncode="false" />

When the UICulture is set to French the HeaderText displays encoded
characters (eg: "Commencé par" instead of "CommencÚ par") so I've
added the HtmlEncode attribute and it works fine.
But if I want to encode the column's data for security reason? And why
encoding the HeaderText??

 
Reply With Quote
 
 
 
 
Roland Dick
Guest
Posts: n/a
 
      07-06-2007
Hi,

jMehdi schrieb:
> added the HtmlEncode attribute and it works fine.
> But if I want to encode the column's data for security reason? And why
> encoding the HeaderText??


if there's no way to make a BoundColumn HTMLEncode your data, try a
TemplateColumn with a Literal control instead. Literals can HTMLEncode
the data.

I fail to understand what HTMLEncoding has to do with security though?

Hope this helps,

Roland
 
Reply With Quote
 
 
 
 
jMehdi
Guest
Posts: n/a
 
      07-06-2007
> I fail to understand what HTMLEncoding has to do with security though?

Data displayed by my BoundColumn is user's data. To prevent cross-site
scripting I want to HtmlEncode the column's data, but not the
HeaderText

I think I have no other choice than using a TemplateColumn

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to loop all form fields and HtmlEncode text? AFN ASP .Net 8 06-15-2004 11:58 PM
Re: URLEncode and HTMLEncode changed? Alexey Smirnov ASP .Net 0 02-25-2004 09:34 AM
Unicode and HtmlEncode Anders Both ASP .Net 4 02-18-2004 05:10 PM
Problem with C# Class and Server.HTMLEncode Andrea Williams ASP .Net 4 01-27-2004 01:21 PM
DataGrid and Htmlencode Michal Raatz ASP .Net 0 07-29-2003 07:21 AM



Advertisments