我們在編寫BS應用程序的時候,經常需要處理客戶訪問的頁面不存在,或者有攻擊者有意訪問錯誤的頁面或者傳入錯誤的參數,然後發現應用程序的漏洞,最近在看《ASP.NET安全變成入門經典》一書,書中就介紹了在web.cofig中配置錯誤跳轉的方法,方法如下:
<system.web>
<customerErrors mode="On" defaultRedirect="~/error.aspx">
<error statusCode="404" redirect="~/notFound.aspx" /> <!--類似於這樣的可以配置很多自己想要的錯誤跳轉頁面-->
</customerErrors >
</system.web>