This is really irritating me, and is probably causing the waning usership on my website. I'm using Forms Authentication to log my user in.
I have the "Persist" parameter set to true by default when the user logs in:
RedirectFromLoginPage(userString, True)
and
SetAuthCookie(userString, True)
In my web.Config file I have the "timeout" attribute set to "129600":
<authentication mode="Forms">
<forms loginUrl="/registration/login.aspx"
timeout="129600" slidingExpiration="true" />
</authentication>
I called my hosting company and they said the problem has to be with my code. I don't believe this is the case.
What the #(@%&@(#%&@(#*% could be wrong??
EDIT This used to work fine until I switched hosts. That led me to believe that it was not my code, but in fact the host.
EDIT 2 In response to a comment to use Fiddler, here's what I get from Fiddler when I load the page:
Set-Cookie: .ASPXAUTH=; expires=Tue, 12-Oct-1999 07:00:00 GMT; path=/; HttpOnly Set-Cookie: .ASPXAUTH=[some gobbledygook]; expires=Sun, 15-Nov-2009 20:46:29 GMT; path=/; HttpOnly Set-Cookie: ASP.NET_SessionId=vudqghfplqnh5hz1qw1cwebt; path=/; HttpOnly
Disable session state at the application level NET, and create a new ASP.NET web application. In Solution Explorer, double-click Web. config to view the contents of this file. Locate the <sessionState> section, and set the mode value to Off.
You need to set FormsAuthentication. SetAuthCookie(PrimaryKey, false); when user is loggedIn. Here, PrimaryKey is the key that you can use throughout the session for identification of the user using User.Identity.Name . Also, when user log out of the application, you will call FormsAuthentication.
Your app pool could be recycling - either on some set time period, or based on a threshold on memory or processor. If it used to work fine, and nothing else changed, I think that would be where I would investigate first.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With