Increase Session Timeout to 5 hours in ASP.Net

on Apr 25, 2021 09:45 PM


I have a sample here from aspsnippets site sample code on time session and it was working properly.

My probelm is i want to expand my time to 5 hours but not working for me.

Display Session Timeout message before Session expires in ASP.Net

Download FREE API for Word, Excel and PDF in ASP.Net: Download
on Apr 25, 2021 11:44 PM

Hi Vanessa,

Where did you set the timeout?

In web.config or IIS?

You need to set it in web.config.

<sessionState mode="InProc" cookieless="true" timeout="300" />

If you are using FormAthuntication then you need to set the timeout in web.config.

    <authentication mode="Forms">
          <forms timeout="300"/>

Also you have to set the app pool Idle Time-out (minutes) to 300 (5 hrs).

Open the IIS Management Console (INETMGR.MSC).

Selectthe Application Pools node. Select the application pool you want to change to run under an automatically generated application pool identity.

Right click the application pool and select Advanced Settings

Then set Idle Time-out (minutes).