标签:简单的错误处理页设置 设置站点默认访问页面优先级 webconfig
1、asp.net 定制简单的错误处理页面<configuration> <system.web> <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"> <error statusCode="403" redirect="NoAccess.htm" /> <error statusCode="404" redirect="FileNotFound.htm" /> </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/> <add value="default.aspx"/> <add value="index.htm"/> <add value="index.html"/> <add value="index.aspx"/> <add value="Default.htm"/> <add value="Default.asp"/> <add value="iisstart.htm"/> </files> </defaultDocument> </system.webServer>
标签:简单的错误处理页设置 设置站点默认访问页面优先级 webconfig
原文地址:http://blog.csdn.net/fuyifang/article/details/40505725