2

I developed an ASP.NET web application that is installed on a "live" IIS 7.5. The web app uses http sessions to pass parameters between pages for logged in users. This works great on my development machine (tested with local IIS in VS2010 IDE), but when this web app is uploaded to a client's IIS and they start using it (Google Chrome and IE browsers), at some random moments the session variables seem to disappear. My first guess was to increase the session timeout setting via web.config file by adding this line:

<configuration>
 <system.web>
  <sessionState timeout="20"></sessionState>
 </system.web>
</configuration>

But that doesn't seem to fix the issue. So it made me wonder, what other settings are there concerning sessions? Something like an internal folder that keeps a cache of all sessions that gets overflown on an actual IIS? Any ideas?

EDIT: Following @wy__'s suggestion, I modified the web.config file and started seeing the same issue on my dev machine. Here's the whole system.web section as I have it now:

  <system.web>
    <compilation targetFramework="4.0" debug="false"/>
    <pages validateRequest="false"/>
    <httpRuntime requestValidationMode="2.0" executionTimeout="110" maxRequestLength="262144"/>
    <sessionState timeout="20" cookieless="true" regenerateExpiredSessionId="true"></sessionState>
  </system.web>

I also checked and there's only one w3wp.exe process running.

8
  • Make sure the browser isn't blocking the cookie on the client machine. Since it is happening at random, this isn't very likely, but it should be on the checklist. Commented Jun 4, 2013 at 21:00
  • Can you tell us more about IIS configuration? Is it a single IIS server, is it a web garden or web farm? Are you using InProc, State or SQLServer session state provider? Commented Jun 4, 2013 at 21:03
  • @RacerNerd: I can't be sure, since it happens on a client's machine. But they report the same issue for Chrome and IE. Commented Jun 4, 2013 at 21:04
  • @HuseinRoncevic: It sounds like a single IIS server. And the SQL Server is not involved in this at all. Commented Jun 4, 2013 at 21:05
  • You should probably check with them to make sure that there is no more than 1 Worker Process involved or that they are not running in a web farm as this could be the reason why you are losing sessions. Commented Jun 4, 2013 at 21:08

1 Answer 1

1

By default, the session uses cookies to track user sessions. If you are not sure whether users turn them off or not, you can configuring cookieless session.

i.e.

<configuration>
    <system.web>
        <sessionState cookieless="true" regenerateExpiredSessionId="true" />
    </system.web>
</configuration>
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. I think you're on to something. I added what you suggested to my web.config and I actually started seeing the same issue on my development machine. What could be wrong there? (I also updated my original question with details.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.