<customErrors>节点用于定义一些自定义错误信息的信息。此节点有Mode和defaultRedirect两个属性,其中defaultRedirect属性是一个可
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.WEB;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.htmlControls;
public partial class CustomErrorsDemo : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
throw new Exception("故意抛出的异常。");
}
}
<customErrors mode="RemoteOnly">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
<customErrors mode="On" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="403.htm" />
<error statusCode="404" redirect="404.htm" />
</customErrors>
到此这篇关于C# web.config之<customErrors>节点说明案例详解的文章就介绍到这了,更多相关C# web.config之<customErrors>节点说明内容请搜索编程网以前的文章或继续浏览下面的相关文章希望大家以后多多支持编程网!
--结束END--
本文标题: C# web.config之<customErrors>节点说明案例详解
本文链接: https://lsjlt.com/news/133859.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0