File Does Not Exist. System.IO.FileInfo GetFileInfo(System.String, System.String, System.Web.HttpResponse)

by rbellantoni 5/18/2012 5:25:00 AM

If you're getting this frustrating error in the application error event in the global.asax file and it looks like this:


12/12/2012 14:49:23
Type : System.Web.HttpException, System.Web, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Message : File does not exist.
Source : System.Web
Help link : 
ErrorCode : -2147467259
Data : System.Collections.ListDictionaryInternal
TargetSite : System.IO.FileInfo GetFileInfo(System.String, System.String, System.Web.HttpResponse)
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 cause of this is because there is a file missing somewhere either an image file or some other referenced file. Now normally this would not throw an error, but the issue seems to appear due to a bad AppRelative path. You check to see what file/image is missing by drilling down into System.Web.HttpContext.Current.Request and looking at the AppRelativeCurrentExecutionFilePath when inside of the application error event to find out what file is missing. There you will see the bad relative path as well as the file it's looking for. Normally it wouldn't throw an error by having a missing image or referenced file path, but because its a relative path and the property is server side it throws a server level error.


Powered by BlogEngine.NET
Theme by Mads Kristensen

About the author

Name of author Author name
Something about me and what I do.

E-mail me Send mail


<<  October 2018  >>

View posts in large calendar

Recent comments



The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2018

Sign in