ASP.NET - Extending the life of the 'Keep Me Logged In' functionality

Websites like this one often make use of the ASP.NET Forms Authentication schema. That schema has an optional parameter that will allow you to admin how long the 'Keep Me Logged In' functionality will remember the person. It does this using a cookie and setting the cookie timeout.

So, here is the snippet of code that you need to administer this and change it from it's default 48 hour setting

You'll find this code on the ASP.NET menu

Change this in the Web.config file. If it doesn't exist, it needs to go inside of system.web. In our example we're changing this to 7 days (10080 minutes)

<authentication mode="Forms">
    <
forms loginUrl="~/Account/Login.aspx" timeout="10080" />
</
authentication>

 


RealWorldCode gives developers practical, real‑world solutions with clean, working code — no fluff, no theory, just answers.
Links
Home
Knowledge Areas
Sitemap
Contact
Et cetera
Privacy Policy
Terms and Conditions
Cookie Preferences