Our website uses our own custom session management separate from the ASP.NET session state. But since several special pages use SQL Server Reporting Services, we also need to enable ASP.NET session state. Because we are in a load-balanced environment, we enabled ASP.NET State Server (aspnet_state.exe or "Out-of-Mode Mode") on a separate server machine.
Today, I noticed that when we temporarily crashed a car with public service in our Dev environment, the Dev site stopped working ("Failed to make a request for session state to the session state server"). This is despite having EnableSessionState = "False" on the loaded page.
Why should ASP.NET connect to the public service when serving a request to a page that does not use session state? This happens even if the page does not use the main page, the base page, or any user controls. I reviewed all of our code to ensure that we will never programmatically re-enable session state or attempt to access it.
--- CHANGE AFTER MORE TROUBLESHOOTING ---
As suggested below, I tried to create a website from scratch to test it without any complications from httpHandlers, httpModules or other user logic.
- I used Visual Studio 2008 to create a new โASP.NET websiteโ using VB.NET .
- I launched the site through VS, allowing it to enable debug mode and create a standard web.config file.
- I added
<sessionState mode="StateServer" stateConnectionString="tcpip=localhost:42424" /> under the <system.web> element and started my local ASP.NET public service ". - I changed the Default.aspx EnableSessionState page to False and reloaded the page = OK.
- I stopped the ASP.NET State Service and reloaded the page = "Failed to complete the session state request to the session state server."
At this point, I was puzzled because other users claimed that they tried something similar and did not experience the same problem. So I wondered if this was related to using VB.NET (this is stupid, although it sounds.) More people use C # for ASP.NET, so I redid my test above with the C # website, and now, without page access exceptions! I only got an exception if I set EnableSessionState to True and actually got access to the session collection in code.
This proves that VB.NET sites in ASP.NET behave somewhat differently, as they access the session state on each page, even if the page is not needed. Unfortunately, this does not answer my original question: Why?
I'm going to cross-post this on the official ASP.NET forums and see if any gurus can shed some light.
Jordan Rieger
source share