Click here to Skip to main content
15,889,808 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have two user types for login,Admin and other user. Idle auto logout for Admin should be 2 hrs(120 min), for other user it should be 15 Min.
For admin user after being idle for more than 20 minutes,application leads to auto logout to login page.
As per my requirement auto logout for admin should be 2hrs.
Early session time out happening for admin user , this issue occurs only in Live environment.

What I have tried:

I used 2 variables inside web config file,
web.config
<pre><appSettings>    
    <add key="AdminUser" value ="120"/> // auto Logout should be 2 hrs for admin
    <add key="OtherUser" value ="15"/>
</appSettings>


<authentication mode="Forms">
			<forms defaultUrl="~/default.aspx" loginUrl="~/login.aspx" slidingExpiration="true" timeout="2880"/>
		</authentication>   
		<sessionState timeout="10800" /> 


Used two variables in Master page Load event after user successful login.
Main.master.cs
if(LoggedInUser=="Admin")
               {
                   Session.Timeout = Convert.ToInt32(ConfigurationManager.AppSettings.Get("AdminUser"));
               }
               //This condition allows other user types except Admin.
               else
               {
                   Session.Timeout = Convert.ToInt32(ConfigurationManager.AppSettings.Get("OtherUser"));
               }


Commented timeout values from Form tag and session state tag.
Also presumes IIS overriding config values and modified IIS session values to 120 min and checked, but Issue remains same in Live environment. Kindly suggest a solution, Thanks in advance
Posted
Updated 30-Jul-17 19:51pm

1 solution

I would think of this: Configure Idle Time-out Settings for an Application Pool (IIS 7)[^]
By default you whole working process goes down after 20 minutes of inactivity, and the session (in process by default) goes with it...
 
Share this answer
 
Comments
punit.vk 31-Jul-17 5:56am    
Thanks for the reply @Kornfeld Eliyahu Peter, I tried doing this,In the application pool, modified the idle timeout to 5 min from its previous value of 25 min.
The application does not time-out after 5 min but still times-out after around 30 min.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900