Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can a FormsAuthenticationTicket survive an app pool recycle?

I am looking for a solution where we can make a FormsAuthenticationTicket (and corresponding cookie) with a very long expiration period. This is possible by setting a high value or using a sliding expiration, but when the application pool of the website is recycled, the FormsAuthenticationTicket disappears (I think), the cookie gets invalid and the user is asked to login again.

Is there any way around this?

like image 460
Gerrie Schenck Avatar asked Sep 09 '10 13:09

Gerrie Schenck


People also ask

What happens when application pool is recycled?

What is application pool recycling in IIS? Recycling means that the worker process that handles requests for that application pool is terminated and a new one is started. This is generally done to avoid unstable states that can lead to application crashes, hangs, or memory leaks.

Does recycling app pool clear session?

As an aside you should schedule any application pool recycles to occur during off-peak hours, as you've realised it will clear any active sessions and will break the user experience if the application relies on session storage.

How often should an app pool recycle?

By default, an IIS application pool (or “AppPool”) recycles on a regular time interval of 1740 minutes, or 29 hours. One reason for this time interval is that application pools don't recycle at the same moment every day (every day at 07.00 for example).


1 Answers

Set static machineKeys instead of the auto generated. This way the FormsAuthenticationTicket will survive app pool recycling.

like image 145
Darin Dimitrov Avatar answered Nov 10 '22 07:11

Darin Dimitrov