asp.net FormsAuthentication : how to set multiple timeout values in the config file?
<p>I'm trying to implement a 'remember me' functionality on my website to allow the users to remain logged in without having to login again.</p>

<p>I do something like this:</p>

<pre><code>System.Web.Security.FormsAuthentication.SetAuthCookie(userName, true);
</code></pre>

<p>I've noticed that the 2nd parameter (createPersistentcookie) is not really persistent as it depends on the timeout value set in the config file.</p>

<p>From what I understand:</p>

<p>if createPersistentcookie=false then the user will automatically be logged out if s/he closes the browser or after x minutes of activity (x being specified in the config file).</p>

<p>if createPersistentcookie=true then the user will NOT be logged out if s/he closes the browser but will still be logged out after x minutes of activity (x being specified in the config file).</p>

<p>Note that in both cases 'x' has the same value and comes from the config file.</p>

<p>What I would like to do is:</p>

<p>-if the visitor doesn't want to stay logged in all the time I would like him to be automatically logged out after 20mn of inactivity of if he closes the browser. To do this I would set createPersistentcookie to false and the timeout value to 20mn.</p>

<p>-if the visitor DOES want to stay logged in all the time I would like him to be automatically logged out only after 7 days of inactivity. Closing the browser won't log him out. To do this I would set createPersistentcookie to true and the timeout value to 7 days.</p>

<p>You see the problem: in one case the timeout is set to 20mn and in the other case the timeout is set to 7 days but in the config file I can only specify 1 value.</p>

<p>Any suggestions?</p>
