J
Jonathan Wood
I have the need to encode several fields into the Value of each list item in
a combobox.
One of those items is a user-supplied string, so I run
HttpUtility.HtmlEncode() on it. But I also need to deal with situations
where the string contains the character used to delimit my values
(currently, a colon). So I convert the resulting encoded string using
Replace(":", ":").
But now the problem is that I get a page error on the post back (A
potentially dangerous Request.Form value was detected from the client...).
I know I can set ValidateRequest to false in the page but this is actually
part of a user control. I would much prefer to workaround this issue rather
than making the blanket requirement that all pages using the control must
set ValidateRequest to false.
Is there absolutely no code I can write in the user control to handle this
error in this particular location without disabling validation for
everything on the page?
Thanks.
a combobox.
One of those items is a user-supplied string, so I run
HttpUtility.HtmlEncode() on it. But I also need to deal with situations
where the string contains the character used to delimit my values
(currently, a colon). So I convert the resulting encoded string using
Replace(":", ":").
But now the problem is that I get a page error on the post back (A
potentially dangerous Request.Form value was detected from the client...).
I know I can set ValidateRequest to false in the page but this is actually
part of a user control. I would much prefer to workaround this issue rather
than making the blanket requirement that all pages using the control must
set ValidateRequest to false.
Is there absolutely no code I can write in the user control to handle this
error in this particular location without disabling validation for
everything on the page?
Thanks.