G
Guest
In ASP.NET 1.1 I could detected expired form authentication tickets (which
closely coincide with my expired session) by checking for the Authentication
Cookie when the login screen loads. If the cookie exists, then decrypt the
forms auth. ticket and check to see if it is expired. If so display a
message to the user letting them know why they are back on the login screen.
The code I used was something like this:
Dim cookie as HttpCookie =
Request.Cookies(FormsAuthentication.FormsCookieName)
Dim ticket as FormsAuthenticationTicket =
FormsAuthentication.Decrypt(cookie.value)
If ticket.IsExpired Then ...
Now when upgrading to ASP.NET 2.0 I am finding that
Request.Cookies(FormsAuthentication.FormsCookieName) will only return the
Auth cookie PRIOR to the expiration of the Auth Ticket. Afterwards,
Request.Cookies will not contain the cookie. I can still get to the Cookie
with Request.Headers("Cookie") and manually pull it out but I just wanted to
verify that this is in fact a change in .NET 2.0 and not just me missing
something...Reflector on the HttpRequest.Cookies property doesn't seem to
show anything removing the Auth cookie, so I'm a little perplexed...
Is there a better way to detected expired sessions? I know some people use
the Session.IsNew() property in conjunction with searching for the
preexistance of the session cookie but for me this does not work because I am
dealing with several asp.net apps that share an authentication cookie but all
have different session states. Thus, I just use the auth ticket expiration
as it (used to be) easier to detect...
Thanks in advance for the input!
closely coincide with my expired session) by checking for the Authentication
Cookie when the login screen loads. If the cookie exists, then decrypt the
forms auth. ticket and check to see if it is expired. If so display a
message to the user letting them know why they are back on the login screen.
The code I used was something like this:
Dim cookie as HttpCookie =
Request.Cookies(FormsAuthentication.FormsCookieName)
Dim ticket as FormsAuthenticationTicket =
FormsAuthentication.Decrypt(cookie.value)
If ticket.IsExpired Then ...
Now when upgrading to ASP.NET 2.0 I am finding that
Request.Cookies(FormsAuthentication.FormsCookieName) will only return the
Auth cookie PRIOR to the expiration of the Auth Ticket. Afterwards,
Request.Cookies will not contain the cookie. I can still get to the Cookie
with Request.Headers("Cookie") and manually pull it out but I just wanted to
verify that this is in fact a change in .NET 2.0 and not just me missing
something...Reflector on the HttpRequest.Cookies property doesn't seem to
show anything removing the Auth cookie, so I'm a little perplexed...
Is there a better way to detected expired sessions? I know some people use
the Session.IsNew() property in conjunction with searching for the
preexistance of the session cookie but for me this does not work because I am
dealing with several asp.net apps that share an authentication cookie but all
have different session states. Thus, I just use the auth ticket expiration
as it (used to be) easier to detect...
Thanks in advance for the input!