[Solved] Web Page expires when user is not active (Idle) for 5 Minutes after hosting

on Jun 08, 2020 12:46 AM

dear fiend

The first, thanks the friends in this forum has helped me a lot of to build the application website ASP.net C#.

At moment, I finish create  the webapp, but I'm facing a problem is when i open the web, in 5 minutes if I don't have any actions on page then click on any  link on  website, it will redirect to login page.

Why web pages expire when do not active in 5 minutes

i login to control panel and go to application pool and see that:

Idle timeout (minutes) 5

Amount of time a worker process will remain idle before it shuts down.

I can't edit the minutes, it read only.

my web.config:

<?xml version="1.0" encoding="UTF-8"?>
  <configSections />
  <appSettings />  
    <httpRuntime executionTimeout="999999" />
    <compilation debug="true" targetFramework="4.5.2" />  
    <trust level="Full" />
    <authentication mode="Forms" />     
    <sessionState timeout="60"></sessionState>
    <customErrors mode="Off" defaultRedirect="" />
    <machineKey validationKey="308A5193B77D18BB33F286DCC941A54331AE8D000104EAC1DB843D98B1CB457AF9A813B4D5D7D77220987AC8EA478401577194FC20E6CCE8ACEC159C5C59D754" decryptionKey="46C25F7D8BFDE6DAF886AEC2706EFA6A2706C43C752B69C82D5B13A29EA246C1" validation="SHA1" decryption="AES" />
    <directoryBrowse enabled="true" />
                <clear />
                <add value="default.aspx" />
                <add value="Default.htm" />
                <add value="Default.asp" />
                <add value="index.htm" />
                <add value="index.html" />
                <add value="iisstart.htm" />

In my code I use masterpage (main.master) and session:


if user Login susscess:

HttpContext.Current.Session.Timeout = 60; 
HttpContext.Current.Session["UserName"] = txtUserName.Text;

In main.master i use:

<asp:ScriptManager id="toolScriptManageer1" runat="server" EnableHistory="true" EnablePartialRendering="false" EnablePageMethods="true"> </asp:ScriptManager>

and in Main.master.cs: 

        protected void Page_Load(object sender, EventArgs e)
            if (HttpContext.Current.Session["UserName"] == null)
            if (!IsPostBack)
                  DataTable dt = this.GetData(0);
                  PopulateMenu(dt, 0, null);               

Please help me

Download FREE API for Word, Excel and PDF in ASP.Net: Download
on Jun 10, 2020 07:21 AM

Hi test0101,

You need to set Idle Timeout inorder to resolve the issue.

Idle Timeout is if no action has been asked from your web application, the process will drop and release everything from memory.

Since it is disabled you need to contact the hosting provider to request for enabling it.

Or refer below link to set Idle Timeout.


on Jun 10, 2020 09:36 PM

Dear dharmendr

after request hosting administrator change idle timeout in iis_application pool to 60, my web don't expire after 5 minutes.

Thanks you very much!!!