I have a Global.asax file that has logging code inside Application_Error handler. I need to customize it in such a way that the Application_Error handler is not reached if the exception is happened while looking for a favicon.ico file. How can we bypass the hitting of Application_Error when the exception is for favicon.ico?
Exception: File does not exist.
Url: http://localhost:14658/favicon.ico
Note: There is no favicon.ico reference in the solution
Note: I am using internet explorer as the browser
CODE
protected void Application_Error(object sender, EventArgs e)
{
Exception occuredException = Server.GetLastError().GetBaseException();
string connectionString = ConfigurationManager.ConnectionStrings[UIConstants.PayrollSQLConnection].ConnectionString;
ExceptionBL exceptionBL = new ExceptionBL(connectionString);
string location = Request.Url.ToString();
exceptionBL.SubmitException(occuredException.Message, location);
}
Reference:
I think you can just add favicon.ico on your project (IIS)