62,254
社区成员
发帖
与我相关
我的任务
分享
Global.asax(如果需要,可以记录错误日志) void Application_Error(object sender, EventArgs e)
{
Exception objErr = Server.GetLastError().GetBaseException();
string error = "发生异常页: " + Request.Url.ToString() + "";
error += "异常信息: " + objErr.Message + "";
Server.ClearError();
Application["error"] = error;
Response.Redirect("~/ErrorPage.aspx");
}
ErrorPage.aspx
protected void Page_Load(object sender, EventArgs e)
{
ErrorMessageLabel.Text = Application["error"].ToString();
}