Application_Error not working on production server
Application_Error did not start on production server. but it works on our local server and another amazon server. our local server has a Windows7 version and an IIS version (7.5), but the production server has a Windows8 and IIS version (8+). anyone has any idea.
void Application_Error(object sender, EventArgs e)
{
// Code that runs when an unhandled error occurs
Exception ex = Server.GetLastError().GetBaseException();
string cls = ex.TargetSite.DeclaringType.Name;
string mtd = ex.TargetSite.Name;
string ErrorMessage = ex.Message;
string page = Request.Path;
string url = Request.PhysicalPath;
string StackTrace = "";
string inputdata = "";
if (ErrorMessage != "File does not exist.")
{
StackTrace = ex.StackTrace;
foreach (string i in Session.Contents)
{
if (Session[i] != null)
{
if (inputdata != "")
{
inputdata = inputdata + " , [" + i + "] = " + Session[i].ToString();
}
else
{
inputdata = "[" + i + "] = " + Session[i].ToString();
}
}
}
string flg = objBus.insertException(page, "", ErrorMessage, StackTrace, "", url, Session["UserID"].ToString(), inputdata,"");
//string flg = "0";
//Response.Redirect("~/ErrorPage.aspx?errorId=" + flg, false);
Server.Transfer("~/ErrorPage.aspx?errorId=" + flg, false);
}
}
+3
source to share
No one has answered this question yet
Check out similar questions: