I've taken over the code of a website from someone else to finish off and have hit the issue that every time I load a page, I get a 'File Does Not Exist' exception caught in the Application_Error handler in my Global.asax file.
I was curious what it was, so have tried creating brand new solutions with both a Web Site and Web Application, both with and without a Master Page and a single .aspx page - both had the same problem.
This is using VS2010 and .NET 3.5, on Windows 7 64-bit.
Any ideas please? The stack trace tells me absolutely nothing and the fact I'm getting it with new projects is odd.
Exception Stack Trace:
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)
The trick in figuring out which file does not exist is to use the following code in the Application_Error
method.
protected void Application_Error(Object sender, EventArgs e)
{
Exception ex = Server.GetLastError().GetBaseException();
string file = HttpContext.Current.Request.Url.ToString();
string page = HttpContext.Current.Request.UrlReferrer.ToString();
}
This will retrieve the name of the file that is missing and the original page from which the request came.
What is the file name in the exception? If the file name or the path is obfuscated, then you likely have a corruption in ASP.NET temporary files. Try "clean solution" and "rebuild solution" and run it again.
Otherwise, you'll need to post more information, including the full exception message, not just the call stack. Is this happening on the default page of the site? Is the web project selected as the startup project? Is this happening in the Visual Studio web server, or IIS?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With