Question

I'm getting a 'File does not exist' error. In my ASP.NET app. This is a strange one, though.

Firstly, there is no file IO code anywhere around - I'm not doing anything with any files when it occurs.

Also, it's happening on the very last closing curly brace of the Application_Error() method in global.asax (that's the one you put code in to handle unhandled exceptions). That's right: it doesn't occur on a throw statement, or any line of meaningful code, but right on the last curly brace.

The TargetSite is:

{System.IO.FileInfo GetFileInfo(System.String, System.String, System.Web.HttpResponse)}

Which looks to me like something internal to ASP.NET (there is no GetFileInfo() method in my solution).

The StackTrace is only:

at ASP.global_asax.Application_Error(Object sender, EventArgs e) in c:\Subversion\ConfApp\Website\Global.asax:line 36 at System.EventHandler.Invoke(Object sender, EventArgs e) at System.Web.HttpApplication.RaiseOnError()

From which I can derive no clues.

Other details:

  • I'm in the middle of trying to resolve conflicts between jQuery 1.4 (and jquery UI) and MS ASP.NET AJAX 4 in this app at the moment

  • It started after I upgraded the app from .net 2.0 to .net 4 and visual studio 2010.

Any idea how I might start looking into this?

Update:
Shortly after posting this, I removed and re-added jquery UI (including .js, .css and the images). So far, it looks like this has fixed it. Not sure how a client-side JS library might cause an error in Global.asax. Will add this as the answer, though, if error doesn't show up again soon...

Was it helpful?

Solution 2

A day later, and the problem appears to be gone.

I removed and re-added jquery UI (including .js, .css and the images). So far, it looks like this has fixed it. Very strange.

OTHER TIPS

Within the ApplicationError method, check Request.CurrentExecutionFilePath. CurrentExecutionFilePath should indicate which file was requested.

Checking this property helped me determine that Chrome automatically requests "/favicon.ico." If there is no favicon, you'll get a "File does not exist," even thought the page loads just fine. BTW, IE and FF do not behave this way.

Using Perry's suggestion of examining Request.CurrentExecutionFilePath in Application_Error, I found that my ASP.Net app couldn't find the jQuery files in folders prefixed with "~/" in the <script> tag.

I was doing this in my MasterPage markup:

<script src="~/Scripts/jquery-1.4.1.js" type="text/javascript">

when I should have been doing this:

<script src="Scripts/jquery-1.4.1.js" type="text/javascript">
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top