Monthly Archives: May 2008

HttpException: File does not exist

Since some time I happened to get a nasty exception in the global.asax Application_Error method. Exception details are below:

Type : System.Web.HttpException
Message : File does not exist.
Source : System.Web
ErrorCode : -2147467259
Data : System.Collections.ListDictionaryInternal
TargetSite : Void ProcessRequestInternal(System.Web.HttpContext)
Stack Trace :
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)

After some hard time trying to resolve this bug, I finally figured out what the problem was. The problem related to this exception is an HttpRequest to a non-existing source, not being the main request, but something like an image or iframe source. In my case, it was an iframe source loaded with a non-existing document.

To resolve this exception at your place, add the following to your Watch window: ((HttpApplication)sender).Context.Request.Url and set a breakpoint on the Application_Error method. This way, the exception will clarify itself a lot (it definitely did for me).