HttpException: File does not exist

May 13th, 2008

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).

If you like this blog post, you can easily share it:
  • HttpException: File does not exist services sprite
  • HttpException: File does not exist services sprite
  • HttpException: File does not exist services sprite
  • HttpException: File does not exist services sprite
  • HttpException: File does not exist services sprite
  • HttpException: File does not exist services sprite
  • HttpException: File does not exist services sprite
  • HttpException: File does not exist services sprite
  1. mike
    March 8th, 2011 at 04:35 | #1

    Thanks a lot !!

  2. Anonymous
    February 17th, 2011 at 21:33 | #2

    Thanks! Depening on your config you may have to qualify the HttpApplication – ((System.Web.HttpApplication)Sender).Context.Request.Url – Problem was the favicon.ico. Never would hae figured that out without your help

  3. Bert Loedeman
    February 5th, 2011 at 18:27 | #3

    You are welcome :) !

  4. davi
    February 3rd, 2011 at 11:58 | #4

    thanks!!

  5. Bert Loedeman
    November 3rd, 2010 at 14:07 | #5

    @Bob
    Sorry for being late on answering. Problem is that I’m running at some deadlines ;)

    The URL in the watch is the URL of the file the system cannot find, therefore, in my opinion that still equals the file that cannot be found ;) .

    Hope that helps!

  6. Bob
    October 28th, 2010 at 15:01 | #6

    I’m having the same problem but I’m not seeing how your solution fixes it. Lot’s of ppl are on here thanking you which tells me I’m missing something.

    I can’t figure out what file my system cannot find.

    Is there a specific property under ((HttpApplication)sender).Context.Request.Url that shows the missing file?

  7. Tri Nguyen
    September 6th, 2010 at 23:31 | #7

    This is really a great tip. Thank you very much !!!

  8. Anonymous
    June 11th, 2010 at 10:17 | #8

    You rock! Thanks for sharing, excellent tip.

  9. OMG
    June 8th, 2010 at 02:45 | #9

    THANK YOU! :)

  10. Khayman
    January 18th, 2010 at 06:50 | #10

    THANK YOU! Damn that was annoying me

  11. Anonymous
    November 16th, 2009 at 05:40 | #11

    Thanks. This was quite annoying to find!

  12. Faisal Fareed
    September 3rd, 2009 at 04:43 | #12

    thanks a lot bert… my database table was just filling up madly with this exception… it helped a lotttttttt again thanks :)

  13. Gulshan
    September 1st, 2009 at 14:15 | #13

    Thanks a lot !!!

  14. Gulshan
    September 1st, 2009 at 14:14 | #14

    Thanks a Lot.

  15. ab
    August 5th, 2009 at 13:15 | #15

    Thanks a lot!!

  16. Anonymous
    January 23rd, 2009 at 11:21 | #16

    YOU F’ing ROCK DUDE! I been trying to figure this one out for awhile!!
    BERT IS DA MAN!!!!!!!
    WOOHOO!! Thanks my friend!!!

  17. Chirag Davda
    January 16th, 2009 at 01:47 | #17

    THANKS A LOT :)

  18. Anonymous
    January 14th, 2009 at 11:27 | #18

    In many cases this misterious file is “favicon.ico”
    (I got ‘http://localhost:5086/favicon.ico‘ while debugging)

    Just add any empty icon into website root directory if you have no

  19. Anonymous
    January 14th, 2009 at 11:16 | #19

    THANK YOU!!!!

    I had this problem for a long time, and now it’s resolved!

    I’m your fan now =)

    Sleza4e

  20. Joel
    January 2nd, 2009 at 16:52 | #20

    This was helpful to me. Thank you.

  21. Anonymous
    December 17th, 2008 at 18:57 | #21

    Thank you very much! This was very helpful.

  22. Anonymous
    December 4th, 2008 at 18:03 | #22

    Thank you!

  23. Bert Loedeman
    November 28th, 2008 at 14:20 | #23

    You’re welcome :) !

  24. Anonymous
    November 28th, 2008 at 08:51 | #24

    thank you!

Comments are closed.