0

I have set session timeout to 2880 seconds (48 minutes) in my web.config file which is:

<system.web>
    <authentication mode="Forms">
        <forms loginUrl="~/Account/Login" timeout="2880" />
    </authentication>
    <sessionState mode="InProc" timeout="2880" cookieless="false" customProvider="DefaultSessionProvider" >
        <providers>
            <add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxx" connectionStringName="DefaultConnection" />
        </providers>
    </sessionState>
</system.web>

When I run this program locally, it's working, but when I test it online after deploying, my session times out after 20 minutes.

TylerH
  • 20,799
  • 66
  • 75
  • 101
Noman Ahmad
  • 378
  • 1
  • 3
  • 19
  • How do you deploy? Does your deployment process apply any web.config transformations? If it does, have a look at the web.release.config file and make sure the timeout value there is not altered. – iamruss Jun 07 '16 at 10:49
  • @iamruss no it doesn't apply any transformations and web.release.config have same timeout value. – Noman Ahmad Jun 07 '16 at 11:11

2 Answers2

0

In sessionState, the time-out is given in minutes....try changing the line to:

<sessionState mode="InProc" timeout="48" cookieless="false" customProvider="DefaultSessionProvider" >

And have a look...

SamGhatak
  • 1,487
  • 1
  • 16
  • 27
0

The timeout attribute in sessionState allows you to set the time in minutes,and default timeout is 20 minutes.

you can use.

<sessionState mode="InProc" timeout="2880" cookieless="false" />

for more information refer this links. https://msdn.microsoft.com/en-in/library/h6bb9cz9(v=vs.85).aspx, How to set session timeout in web.config

Community
  • 1
  • 1
Harish Nayak
  • 348
  • 3
  • 18