Quantcast
Channel: How to catch HttpRequestValidationException in production - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Answer by bruno for How to catch HttpRequestValidationException in production

$
0
0

Ok, i found it my self.I must clear my last error.

protected void Application_Error(object sender, EventArgs e){    var context = HttpContext.Current;    var exception = context.Server.GetLastError();    if (exception is HttpRequestValidationException)    {        context.Server.ClearError();    // Here is the new line.        Response.Clear();        Response.StatusCode = 200;        Response.Write(@"<html><head></head><body>hello</body></html>");        Response.End();        return;    }}

Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>