Why Page_Error can't catch an HttpRequestValidationException?

B

bondzhou

I have the following code in Page_Error handler subroutine:

Exception ex =Server.GetLastError();
Response.Write(ex.Message);
Response.Write(ex.StackTrace);
Server.ClearError();

But it doesn't work when an HttpRequestValidationException occurs(I input a
html tag into the TextBox control in the page and submit it).I have attach
the Page.Error event to it's handler--the Page_Error subroutine.the same
code in the Application_Error works well.Why?
 
P

Patrice

It would make sense having ASP.NET to perform this check before loading the
page... (you can check the call stack to make sure).

Patrice
 

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

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,150
Members
46,697
Latest member
AugustNabo

Latest Threads

Top