在你的默認路由,你可以/應該對於初學者
routes.MapRoute("Catch All", "{*path}", new { controller = "Home", action = "ErrorPage" });
編輯2
的問題就出在部分redirectMode="ResponseRewrite"
沒有這個補充這一點,它的工作原理。
使用路線雖然將解決這個問題,其中,所述路徑不能被找到(404)
下一部分,像與壞的ID或其他數據存在的路徑,1份可以是固定的與
<customErrors mode="On" defaultRedirect="/Home/ErrorPage" />
redirectMode="ResponseRewrite"
究竟做了什麼?
編輯:它做了什麼。
redirectMode
- ResponseRedirect:指定 URL直接瀏覽器必須 從原來的Web 請求URL不同。
- ResponseRewrite: 指定指向 瀏覽器的URL必須是原始Web 請求URL。
它只對.NET 3.5 SP1和.NET 4.0很重要。
編輯101:
對於redirectMode = 「ResponseRewrite」 的ASP.NET調用使用Server.Execute(...)內,不與MVC路線的工作,所以對於MVC這只是一個工作靜態HTML文件。
<customErrors mode="On" defaultRedirect="~/Views/Shared/error.htm" redirectMode="ResponseRewrite" />
的作品。
我對此很好奇。 – Rohrbs 2010-09-20 17:36:07
另請參閱http://stackoverflow.com/questions/3749083/oracle-padding-exploit-how-does-it-download-the-web-config – bzlm 2010-09-20 19:01:09
剛剛更新我的問題,因爲斯科特在這裏發佈了一個常見問題 - http:// weblogs.asp.net/scottgu/archive/2010/09/20/frequently-asked-questions-about-the-asp-net-security-vulnerability.aspx。 – 2010-09-21 07:55:58