时间:2021-07-01 10:21:17 帮助过:63人阅读
- <configuration> <system.web><customerrors mode="RemoteOnly" defaultredirect="GenericErrorPage.htm"> <error statuscode="403" redirect="NoAccess.htm"> <error statuscode="404" redirect="FileNotFound.htm"> </error></error></customerrors></system.web></configuration>
- void Application_Error(object sender, EventArgs e) { Exception objErr = Server.GetLastError().GetBaseException(); string error = "发生异常页: " + Request.Url.ToString() + "<br>"; error += "异常信息: " + objErr.Message + "<br>"; Server.ClearError(); Application["error"] = error; Response.Redirect("~/ErrorPage/ErrorPage.aspx"); }
- <system.webserver> <defaultdocument> <files> <clear> </clear></files> </defaultdocument> </system.webserver>