How to catch HttpRequestValidationException

G

Guest

When a user enters a html tag <BR> in one of my textboxes, asp.net by default
gives the error:
"A potentially dangerous Request.Form value was detected from the client
....".

I understand that I can turn this error off by setting validateRequest=false
in the Page directive. However, I want to turn this property on and catch the
error using try and catch, but that didn't work. Is there a way to catch it
so that I can show the error in a more user friendly way. Thanks.
 
I

Ivan Belov

Hi,

How about wiring a handler to Page.Error event?

Error += new EventHandler (this.Page_Error);

/Ivan Belov/
 

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

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top