Why Page_Error can't catch an HttpRequestValidationException?

  • Thread starter Thread starter bondzhou
  • Start date Start date
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?
 
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
 
Back
Top