用户名:
密 码: 记住
您当前的位置:首页 > 网络编程 > Net教程

asp.net 在global中拦截404错误的实现方法

时间:2015-01-29  来源:互联网  作者:佚名
复制代码 代码如下:
void Application_Error(object sender, EventArgs e)
{
if(Context != null)
{
HttpContext ctx = HttpContext.Current;
Exception ex = ctx.Server.GetLastError();
HttpException ev = ex as HttpException;
if(ev!= null)
{
if(ev.GetHttpCode() == 404)
{
ctx.ClearError();
Response.Redirect("~/nofound.aspx", false);
Response.End();
}
else
{
Server.Transfer("~/Error.aspx", false);
}
}
}
}
来顶一下
返回首页
返回首页
推荐资讯
aspnet_regsql.exe 工具注册数据库的图文方法 aspnet_regsql.exe 工具注册数据库同时也提供了新的用来管理权限的控件,比如 Login但是,使用
asp.net Coolite TablePanel使用 asp.net Coolite TablePanel使用其中用得最多的就是他的Tabs属性,用于定义子标签选项,可参
相关文章
栏目更新
栏目热门