protected void Application_Error(object sender, EventArgs e)
{
//捕获整个解决方案下的所有异常
try
{
RedirectStatusCode404();
}
catch { }
}
/// <summary>
/// 404跳转(程序之后不再执行)
/// </summary>
public static void RedirectStatusCode404() {
RedirectStatusCode( 404, "/Error.html" );
}
#region RedirectStatusCode Transfer跳转
/// <summary>
/// 返回statusCode,按指定url进行Transfer跳转
/// </summary>
/// <param name="statusCode"></param>
/// <param name="url">虚拟路径</param>
public static void RedirectStatusCode(int statusCode, string url) {
HttpContext context = HttpContext.Current;
context.Server.Transfer( url );
}
#endregion
欢迎光临 苏飞论坛 (http://www.sufeinet.com/) | Powered by Discuz! X3.4 |