Question

I have a web application on .NET4 and MVC3 (razor) .

I want to handle my application errors in Global.asax. I have created application_error function.

I have noticed and found some errors.

one of them returns this string in Application_Error when I am trying to add break point on line Response.Clear(); and that error is generic.

how can I find which codes or part of my codes makes it?

my code:

protected void Application_Error()
    {
        var exception = Server.GetLastError();
        var httpException = exception as HttpException;
        Response.Clear();
        Server.ClearError();
    }

error on httpException:

{System.Web.HttpException (0x80004005): File does not exist.
  at System.Web.StaticFileHandler.GetFileInfo(String virtualPathWithPathInfo, String 
  physicalPath, HttpResponse response)
  at System.Web.StaticFileHandler.ProcessRequestInternal(HttpContext context, String 
  overrideVirtualPath)
  at System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, 
  AsyncCallback callback, Object state) at   
  System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionSt
ep.Execute()
 at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& 
 completedSynchronously)}
Was it helpful?

Solution

i found the solution

string errorLocation = Request.Path;

this syntax in Application_Error() tel you where is the problem :)

OTHER TIPS

Just to state my experience with this exception, in my case the reason was that there was no webpage specified as the start page for the site.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top