0

apparently attributes on web controls are automatically partially encoded

for example, if you do the following

System.Web.UI.WebControls.Image img = new System.Web.UI.WebControls.Image();
img.Attributes.Add("whatever","<");

you get this in html

<img whatever="&lt;" />

(the < is encoded)
but,

img.Attributes.Add("whatever",">");

results in

<img whatever=">"/>

(the > is not encoded)

i dont know why. it would be nice if the developer could be trusted to do his own half assed encoding if the need came up, instead of fighting to undo it... anyway, how do i undo it? i need to make it not screw up my code so i can pass html to a js function

1
Contributor
1
Reply
3
Views
6 Years
Discussion Span
Last Post by scranton
0

dont worry about it. it turns out all the "&lt;"s werent an obstacle. just a distracting bunch of encoded characters. i figured out they can be decoded back to normal with some ascii anyway - .replace('<',String.fromCharCode('60')) - right before i figured out they werent causing a problem...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.