3
votes

I have checked various questions asked in SO in this topic also tried the solutions provided for the various questions, but it doesnt work for me. My application is ASP .Net4.5, I store username, usertype in session and later it is used while inserting data to the SQL tables. I have set the session time out in webconfig as follows.

  <system.web>
      <authentication mode="Forms">
        <forms loginUrl="Login.aspx" name=".mycookie" timeout="60"></forms>
  </authentication>
<sessionState mode="InProc" cookieless="false" timeout="60" />

In the IIS settings against Sessionstate the following were set

SessionState = In Process
Cookie settings -> Mode = Use Cookies
                   Name = ASP.Net_SessionId
                   Timeout (min) = 60

I'm not sure whether I'm setting this in wrong way in the above settings. The issue is my application session timeouts much before the set time, I feel it gets timeout in 10-15 minutes. Please advise how to set the timeout value correctly.

3
@Anil, My webconfig file already has the values mentioned in your reference, but still it doesnt work. - Shah

3 Answers

0
votes

Probably, you are getting problem with form authentication timeout and session timeout. Please see here.

0
votes

Try this in web config file.

<system.web>
    <authentication mode="Forms">
          <forms timeout="50"/>
    </authentication>

    <sessionState timeout="60"  />
</system.web>
0
votes

I tried setting session timeout, but it didnt worked for me. I decided to store those session variables used in cookies, and read from cookies. Now there is no session timeout issue. I clear the cookies while login to the application, also set the expiry to 1 day to avoid any issue. Thanks for helping me.