在常規的ASP.NET應用程序,你可能有一個的customErrors部分類似如下:設置自定義404錯誤頁面編程
<customErrors mode="On">
<error statusCode="404" redirect="Nice-FileNotFound-Page.aspx"/>
</customErrors>
是否有可能在的Application_Start編程設置404錯誤?像下面這樣:
// Figure out which page should be used... using some logic somewhere in the application
// (obviously) Pseudo-code: Application.ErrorCode.404.Page = Page-Found-Above