Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 ASP.NET 4.5 MVC 4 应用程序。我想将 xyz.com/* 和带有非法字符的恶意 URL 重定向到自定义错误页面。做这个的最好方式是什么?
如果他们像您的示例那样输入无效路线,您可以将自定义错误设置为这样
<customErrors mode="RemoteOnly" defaultRedirect="~/error"> <error statusCode="404" redirect="~/error/Error404" /> <error statusCode="500" redirect="~/error" /> </customErrors>