views:

349

answers:

5

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
+3  A: 

There are a number of things that could be causing a timeout. This Blog provides a great overview.

Eric J.
A: 

Don't forget to use sessionstate timeout.

mcandre
+1  A: 

You could use Fiddler to verify the expiration date set on the cookie that comes back from the login page.

David
see my edit 2 for my fiddler response
Jason
why won't the second cookie stay?
Jason
A: 

The cause of this behavior for me is usually the IIS Idle Timeout.

Trevor Goertzen
+1  A: 

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.

Scott Ivey
is this something the host controls?
Jason
Yes. See this for IIS6 - http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/1eee28e2-b319-4b4e-8267-a8c0aa0dcf36.mspx?mfr=true and this for IIS7 - http://technet.microsoft.com/en-us/library/cc753179(WS.10).aspx.
Scott Ivey
ugh... my host is godaddy... guess this problem isn't going away any time soon...
Jason