I asked a question about this a few months back, and it ended up off on a tangent. However, I'm having the problem again, and I need to get this resolved.
I have a web app (C#, and ASP.Net 2.0 developed using Visual Studio 2005), and in the Global.asax Session_Start event, I am calling a number of methods from a Class Library my unit developed to populate Session variables that are used throughout the app. The app physically resides on a web server, so after compiling/building the site, we access it using IE and the virtual directory that's set up using IIS.
Here's where it gets frustrating. After building the site and trying to access it, I get an error message thrown from Default.aspx's code-behind, in essence saying that a Session variable I populated in Global.asax is null (that's my translation of the error code put in context). So wondering if I messed it up somehow, I put a Debug breakpoint in the Session_Start method in Global.asax and stepped through the whole method, only to see it work perfectly, and the IE window it brought up while debugging displays the page just like it should. But if I just put the virtual address in IE and try to access it normally, I still get the error.
So why can I get the page to work in Debug mode, but not normally?
When we access the application from the Visual Studio 2005 it makes use the Development web server.
And as you mentioned, the problem occured when you running the application using Virtual Directory, could you make sure once the ASP.NET Configuration for this web application points to .NET Framework 2.x.
This might be already configured properly, but as a first step of reviewing the application for the issue, I am asking this to verify.
Thanks