Click here to Skip to main content
15,867,141 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
error logging information is..
2015-09-18 10:42:40,337
Global
HTML
[(null)] 
>> System.Web.HttpException: File does not exist.
   at System.Web.StaticFileHandler.GetFileInfo(String virtualPathWithPathInfo, String physicalPath, HttpResponse response)
   at System.Web.StaticFileHandler.ProcessRequestInternal(HttpContext context)
   at System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Posted
Updated 17-Sep-15 19:27pm
v3

1 solution

When you log error, log both error and the request url. for example
C#
protected void Application_Error(object sender, EventArgs e)
{
    Exception ex = Server.GetLastError();
    Log.Error("An error occurred", ex);
    Log.Error("Requested url: ", Request.RawUrl);
}


UPDATE:
if you need to avoid css files
C#
if (!Request.RawUrl.EndsWith("css"))
{
    Exception ex = Server.GetLastError();
    Log.Error("An error occurred", ex);
}
 
Share this answer
 
v2
Comments
User-11630313 18-Sep-15 2:37am    
thank you @DamithSL....is there any possible way to avoid error logging to stylesheets in web application?
DamithSL 18-Sep-15 2:46am    
check my updated answer
User-11630313 18-Sep-15 3:05am    
thank you so much its works fine...you are superb!!
DamithSL 18-Sep-15 3:08am    
you are welcome!
Wendelius 19-Sep-15 4:45am    
Good advice, a 5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900