protected void Application_Error(object sender, EventArgs e) {Exception objErr = Server.GetLastError().GetBaseException(); if (objErr.GetType() == typeof(HttpException)) { int i = ((HttpException)objErr).GetHttpCode(); if (i == 404) { Response.Redirect("notFound.html"); } else if (i == 403) { Response.Redirect("forbidden.html"); } else if (i == 500) { Response.Redirect("forbidden.html"); } } else { String GoUrl = String.Format("errorPage.html"); Response.Redirect(GoUrl); } }在自己電腦上用VS2008 打開 無論是.aspx文件或者是.html文件都可以跳轉的我規定的錯誤頁面。但是在IIS就是不行了如果是后綴是.aspx里的程序出錯,那是可以跳轉的我規定的錯誤頁面。但是如果是一個不存在的問題.html文件,無效 就是這個錯誤了 看起來一點都不友好
- 2 回答
- 0 關注
- 827 瀏覽
添加回答
舉報
0/150
提交
取消