Last post Nov 04, 2014 07:50 PM by johnjohn123123
Oct 31, 2014 10:06 PM|johnjohn123123|LINK
I have the following:-
- Web.config file as follow:-
<httpRuntime targetFramework="4.5" />
<forms loginUrl="~/Account/Login" timeout="2880" />
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
- The login action method is as follow:-
public ActionResult Login(LoginModel model, string returnUrl)
domainProvider = Membership.Providers["TestDomain1ADMembershipProvider"];
if (domainProvider.ValidateUser(model.UserName, model.Password))
ModelState.AddModelError("", "The user name or password provided is incorrect.");
List<String> domains2 = new List<String>();
ViewBag.Domains = domains2;
List<String> domains = new List<String>();
ViewBag.Domains = domains;
- The IIS setting is as follow. i set the idle timeout for the application pool to be 20 minutes.
Now our test server will keep the user login for more than one day , so even if I shut down my pc and I did not logout, I can use the test application without the need to login. But inside our live server the situation is different the user will be logout
after less than ½ hour if he did not use the system, but if he keeps working then the system he will not be logout. Baring in mind that my test database and my live database are inside the same server. And I am using form authentication against out ldap server.
So I think the application pool idle time & <sessionState timeout="120"></sessionState> are meaningless in my case because on the Test application the idle timeout is set to 20 minutes and session state to 120 minutes, but users will not be logout for more
than one day. so i think there are different settings which controls when the user will be logout after idle time…
So can anyone advice on what might be causing this problem ?
Nov 02, 2014 10:20 PM|Rion Williams|LINK
If this is occurring after within less than an hour, it could likely be an Idle Timeout through IIS (seen in the second section below). I'll paste the following which I have posted in the past and contains all of the necessary steps to change all
of these various timeouts (Forms Authentication and IIS Idle Timeouts), which may depend on how your current code is implemented.
Setting the Forms Authentication Timeout within your web.config (may not be applicable)
You can adjust the specific timeout property of your Forms Authentication in your application by adjusting the timeout property within the <authentication> element of your web.config file. You will also want to be mindful that if you are using the slidingExpiration
property in conjunction with timeouts as they can actually expire much earlier than the timeout listed.
<authentication mode="Forms"> <forms name=".ASPXAUTH" loginUrl="~/Login.aspx" timeout="yourTimeoutInMinutes"></forms> </authentication>
So if you wanted to extend the amount that the authentication token stays "alive" for to say 60 minutes (an hour), you would set it as seen below :
<authentication mode="Forms"> <forms name=".ASPXAUTH" loginUrl="~/Login.aspx" timeout="60"></forms> </authentication>
However, if you are using the slidingExpiration property, the authentication token can expire when half of the timeout duration has elapsed. So you'll likely want to double your timeout value if you are using it :
<authentication mode="Forms"> <forms name=".ASPXAUTH" loginUrl="~/Login.aspx" timeout="120" slidingExpiration="true"></forms> </authentication>
Setting the Application IdleTimeout property within IIS
You may need to check what your timeout is configured for within IIS, as this timeout will override the timeouts defined in your web.config.
Within IIS there is a setting called Idle Timeout, which defaults at 20 minutes. This could explain your early timeout issue and you may want to consider adjusting this property within IIS. Based on your issue, this could likely be the culprit :
Scott Hanselman also addresses strange issues that can occur when dealing with timeouts when using Forms Authentication in this blog post as
Nov 04, 2014 05:56 AM|johnjohn123123|LINK
ok i will try your settings, but when i tried to chnage the application pool idle time out insdie IIS manager , i got this error :-
The 'Idle Time-out (minutes)' property of the application pool's process model must be less than the 'Regular Time Interval (minutes)' property of the application pool's period restart.
Nov 04, 2014 07:50 PM|johnjohn123123|LINK
i changed the iis application pool idle timeout and the regular time interval inside the Recycling setting to be 10,000 minutes instead of 20 and 1740 minutes. and seems it is working well. but i have a question on what is the maximum time in minutes that
i can specify for the application pool idle timeout ?, for our case we are working on an intranet site, so having the users' cookies active will not cause a security problem, because the user need to be lo-gin to our network to access the system...?