user9070591
user9070591

Reputation:

Session Timeout in C#

I am working in a web application project using asp.net ,my problem is I want to increase my Session time out to 1 hour ,For that I have used in web.config file:

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

but it is not working.

The Particular Page automatically redirects to login page after a few minutes.Why it is happening so?

Upvotes: 0

Views: 1738

Answers (3)

Aravinthan M
Aravinthan M

Reputation: 885

In web config file, change sessionstate timeout propety

<system.web>  
    <sessionState mode="InProc" cookieless="false" timeout="60"/>
</system.web>

Upvotes: 1

Emre Kabaoglu
Emre Kabaoglu

Reputation: 13146

It seems that client cookie is being expired and the IIS redirects user to login page to authenticate again. It is not relevant with sessionState timeout. Try to set timeout of FormsAuthentication;

<authentication mode="Forms">
  <forms loginUrl="~/Account/LogIn" timeout="60" />
</authentication>

Upvotes: 1

hustlecoder
hustlecoder

Reputation: 187

If you want to set the timeout to 1 hour then use the following

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

Upvotes: 1

Related Questions