110,545
社区成员
发帖
与我相关
我的任务
分享
…………
/// <summary>
/// 异常处理
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Application_Error(object sender, EventArgs e)
{
Exception ex = this.Context.Server.GetLastError();
if (ex != null)
{
//登录是否过期
if (!ManageProvider.Provider.IsOverdue())
{
HttpContext.Current.Response.Redirect("~/Login/Default");
}
Dictionary<string, string> modulesError = new Dictionary<string, string>();
modulesError.Add("发生时间", DateTime.Now.ToString());
modulesError.Add("错误描述", ex.Message.Replace("\r\n", ""));
modulesError.Add("错误对象", ex.Source);
modulesError.Add("错误页面", "" + HttpContext.Current.Request.Url + "");
modulesError.Add("浏览器IE", HttpContext.Current.Request.UserAgent);
modulesError.Add("服务器IP", NetHelper.GetIPAddress());
Application["error"] = modulesError;
HttpContext.Current.Response.Redirect("~/Error/Index");//此处出错
}
}