Blogger Widgets
  • Sharing Photos using SignalR
  • TFS Extenstion - allows copy work items between projects
  • Displaying jquery progressbar with ajax call on a modal dialog
  • Managing windows services of a server via a website
  • Exploring technologies available to date. TechCipher is one place that any professional would like to visit, either to get an overview or to have better understanding.

Search This Blog

Monday, 1 November 2010

Server.GetLastError() giving error as 'File does not exist.'

In general Server.GetLastError() is the more used way of getting the last generated error. But have you ever got an error message and does not exactly know what went wrong. Such as the error below:-

{"File does not exist."}

which has actually occurred in the source code at

protected void Application_Error(Object sender, EventArgs e)
    HttpException Error = Server.GetLastError() as HttpException;
    Session["Error"] = Error;
    Response.Redirect("Error.aspx", true);

The error by itself is self explanatory that says a file is missing and might be because of an .aspx, .gif, .js file missing or does not have permission to read the file.

Well finding the cause for this might look daunting when you see it. But its very simple, just follow these steps :-

1. Set a breakpoint at the Server.GetLastError()
2. Now open quickwatch
3. Type Request.CurrentExecutionFilePath

this should give the file that is missing. Also this might generally occur at places such as binding a data grids where an image is bound to a column.

The first rule of intelligent tinkering is to keep all the pieces. -Aldo Leopold


Post a Comment

Copyright © 2013 Template Doctor . Designed by Malith Madushanka - Cool Blogger Tutorials | Code by CBT | Images by by HQ Wallpapers