for error handling I have a few lines of code to detect every error in global.asax: the void Application_Error(object sender, EventArgs e)contents of the function are as follows:
try
{
Exception objErr = Server.GetLastError().GetBaseException();
if (!(objErr is HttpException))
{
shop.BLL.Utility.Errorlog.WriteError(objErr, "Global.asax caught an Exception");
}
else
{
HttpException hex = (HttpException)objErr;
if (hex.ErrorCode == 404)
Response.Redirect("404.aspx?msg=" + hex.Message);
else
{
shop.BLL.Utility.Errorlog.WriteError(hex, "Global.asax caught an HttpException code: " + hex.ErrorCode);
}
}
}
catch { }
Server.ClearError();
now here's the thing: when I go to blabla.aspxthat which does not exist, it ends in a line shop.BLL.Utility.Errorlog.WriteError(hex, "Global.asax caught an HttpException code: " + hex.ErrorCode);and the value of the error code-2147467259
Why is it not 404?
source
share