ValidateRequest Issues

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top