Sarthak Shah
Sarthak Shah

Reputation: 137

session in asp.net is getting close after 2-3 minutes

I have made a web application which uses user authentication and if user is authenticated user then i store it in Session like below.

Session("uid") = txtUid.text

But after 2-3 minutes Session is automatically cleared.

Upvotes: 2

Views: 1997

Answers (3)

Bhupendra Shukla
Bhupendra Shukla

Reputation: 3914

You can set the session state of your web application in web.config. Add this code in the Configuration section of your web.config.

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

Upvotes: 0

Banana
Banana

Reputation: 7483

2 - 3 minutes?

it means that you are not sure how long it takes for the session to close.

from here i can assume that you are using internet explorer?

internet explorer has a known issue with asp.net, if you have an underscore in your virtual path like

www.mySite.com/some_test_site.aspx

so i bet you have a scenario like this.

in any case, you can add the following line to your web.config to keep vars for 60 minutes:

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

it goes under:

<configuration>
   <system.web>

Upvotes: 1

Saad Asif
Saad Asif

Reputation: 99

increase your session time in Web.config

 <system.web>
    <sessionState timeout="260"  />
  </system.web>

Upvotes: 3

Related Questions