0
的Application_Error未发布任何网站,我也取得了自定义错误模式的web配置关闭,烧成后仅远程我也把下面的代码在Application_Error事件Applicaion_Error事件在Global.asax中
var error = Server.GetLastError();
var code = (error is HttpException) ? (error as HttpException).GetHttpCode() : 500;
if (code != 404 || code!=301 ||code!=302)
{
System.Web.HttpApplication app = (System.Web.HttpApplication)sender;
string requestedUrl = app.Request.Path.ToLower();
RequestUrls = requestedUrl;
string realUrl = GetRealUrl(requestedUrl.ToLower());
Server.ClearError();
if (!String.IsNullOrEmpty(realUrl))
Response.RedirectPermanent(realUrl,true);
}