Search code examples
asp.netsessionsessionend

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.


Solution

  • 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>