如何避免网站中的自定义/服务器错误?

Yas*_*ahu 8 html javascript asp.net jquery url-rewriting

我有位于服务器上的asp.net Web应用程序我想避免来自我的网站的所有自定义和服务器错误.

为此,我用过

<customErrors mode="RemoteOnly" defaultRedirect="~/ErrorPage/TryAgainLater.aspx">   <error redirect="~/ErrorPage/PageNotFound.aspx" statusCode="404"/> </customErrors>
Run Code Online (Sandbox Code Playgroud)

使用上面的代码可以避免一些问题.即.

假设我的网站提供了"http://Exaple.com/Careers.aspx"页面

案例1. http://Exaple.com/Careersss.aspx "按照上述规则工作正常".

案例2. http://Exaple.com/!@##Careersss.aspx "不工作"注意:这里我添加特殊字符

案例3:http://Exaple.com/Careersss.aspxxxx "不工作"注意:在".aspx"之后添加字符

案例4:http://Exaple.com/Careersss.aspx/!@!@!"这不是设计打破在这里".注意:添加带有特殊字符的"/".

当用户获得案例2,3,4时请帮助我,然后他们会自动重定向到错误页面.

提前致谢.