how to increase session timeout in asp.net?

后端 未结 6 1710
感动是毒
感动是毒 2020-12-05 10:31

I tried following codes to increase session timeout, but no use,

code is:


<         


        
6条回答
  •  无人及你
    2020-12-05 11:12

    You can increase the session time-out in asp.net in any one of the following ways

    Using IIS Version 7 :

    1. Open up IIS
    2. Select your website from the list of sites
    3. Click on Session state on the right
    4. Now enter your session timeout under the cookie settings

    OR

    Web.config : Open up your web.config file and under the system.web section add the following :

    
    

    Replace 20 with whatever number you wish.

    OR

    Global.asax file : Under the Session_Start method, set the timeout property of the session to the required value like this

    Session.Timeout = "20";
    

    Note : If you are setting a session timeout in both IIS as well as web.config, then the one in IIS will override the one in web.config

    Hope this helps!

提交回复
热议问题