【发布时间】:2010-10-21 03:31:42
【问题描述】:
在常规 ASP.NET 应用程序中,您可能有一个 customErrors 部分,如下所示:
<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
【问题讨论】:
标签: asp.net configuration error-handling web-config