Showing custom error message on exception: A potentially dangerous Request.Form value was detected from the client

前端 未结 1 978
无人共我
无人共我 2021-02-19 07:33

I am using Login Control of ASP.NET in my web application. I want to show a funny type of error on a label when this exception occures System.Web.HttpRequestValidationExce

相关标签:
1条回答
  • 2021-02-19 08:33

    Here are a few examples of how to provide a friendlier error msg:

    http://romsteady.blogspot.com/2007/06/how-to-catch-httprequestvalidationexcep.html

    How to catch HttpRequestValidationException in production

    The thing you need to keep in mind is that this exception is thrown before you page code happens. So you normally cannot catch the error in your page code, but only in Application_Error.

    I have not tried this myself, but this site gives a alternative way to allow your page code to execute, but still protect yourself from malicious input using the built in logic, as well as catching the exception within your own code.

    0 讨论(0)
提交回复
热议问题