on respone.redirect the cookies expier in the timout mentioned rather then sliding effect.
I do a response.redirect depending on type of user so once the response.redirect is done the auth cookie expire in the timeout time instead of considering the siliding effect the same does not happen with FormsAuthentication.RedirectFromLoginPage
method, so before calling response.redirect I called FormsAuthentication.SetAuthCookie which also did not work.
and this all is before the half time of the cookie timeout.
Consider using Response.Redirect("~/path", false) -- this is less aggressive about terminating the current request and thus other plumbing can still operate on the current request (like the forms auth module).
Maybe I didn't understend the issue correctly, by the way the "sliding time" option doesn't work if you didn't pass the half time of the expiring date.
I mean... if the cookies expires at 20.00 and you have a 10 min sliding time if you access the cookie at 19.54 it will not be updated, if you access it at 19.56 the new expire time is set at 20.10
Now on why it works like this is a mystery of course, but that's it :)
I mean... if the cookies expires at 20.00 and you have a 10 min sliding time if you access the cookie at 19.54 it will not be updated, if you access it at 19.56 the new expire time is set at 20.10
Vishal then what you are experiencing it's very odd but maybe it depends on how the asp.net framework uses the sliding expiration parameter.
I mean at wich point in the request lifecycle:
http://msdn.microsoft.com/en-us/library/bb470252.aspx
If you fire the redirect before that point it's not added, BUT it should be in the next page. Try this, do the redirect after the half has we explained before, THEN when the new page appears, hit refresh on the browser to reload the new page and see if the
cookie is there.
VishalNahar
None
0 Points
36 Posts
on respone.redirect the cookies expier in the timout mentioned rather then sliding effect.
May 17, 2012 02:34 PM|LINK
on respone.redirect the cookies expier in the timout mentioned rather then sliding effect.
I do a response.redirect depending on type of user so once the response.redirect is done the auth cookie expire in the timeout time instead of considering the siliding effect the same does not happen with FormsAuthentication.RedirectFromLoginPage method, so before calling response.redirect I called FormsAuthentication.SetAuthCookie which also did not work.
and this all is before the half time of the cookie timeout.
BrockAllen
All-Star
27512 Points
4895 Posts
MVP
Re: on respone.redirect the cookies expier in the timout mentioned rather then sliding effect.
May 17, 2012 03:02 PM|LINK
Consider using Response.Redirect("~/path", false) -- this is less aggressive about terminating the current request and thus other plumbing can still operate on the current request (like the forms auth module).
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/
VishalNahar
None
0 Points
36 Posts
Re: on respone.redirect the cookies expier in the timout mentioned rather then sliding effect.
May 17, 2012 06:50 PM|LINK
no I want it to end so please suggest some other way out
VishalNahar
None
0 Points
36 Posts
Re: on respone.redirect the cookies expier in the timout mentioned rather then sliding effect.
May 21, 2012 07:20 AM|LINK
any help is aapriciated
manight
Member
59 Points
60 Posts
Re: on respone.redirect the cookies expier in the timout mentioned rather then sliding effect.
May 21, 2012 12:53 PM|LINK
Maybe I didn't understend the issue correctly, by the way the "sliding time" option doesn't work if you didn't pass the half time of the expiring date.
I mean... if the cookies expires at 20.00 and you have a 10 min sliding time if you access the cookie at 19.54 it will not be updated, if you access it at 19.56 the new expire time is set at 20.10
Now on why it works like this is a mystery of course, but that's it :)
VishalNahar
None
0 Points
36 Posts
Re: on respone.redirect the cookies expier in the timout mentioned rather then sliding effect.
May 21, 2012 01:04 PM|LINK
it does not update even after half time
hans_v
All-Star
35986 Points
6550 Posts
Re: on respone.redirect the cookies expier in the timout mentioned rather then sliding effect.
May 21, 2012 04:35 PM|LINK
No, the new expire time is set at 20:06
hans_v
All-Star
35986 Points
6550 Posts
Re: on respone.redirect the cookies expier in the timout mentioned rather then sliding effect.
May 21, 2012 04:36 PM|LINK
Is SlidingExpiration set to True?
http://msdn.microsoft.com/en-us/library/system.web.security.formsauthentication.slidingexpiration.aspx
manight
Member
59 Points
60 Posts
Re: on respone.redirect the cookies expier in the timout mentioned rather then sliding effect.
May 21, 2012 05:46 PM|LINK
Yep hans right.
Vishal then what you are experiencing it's very odd but maybe it depends on how the asp.net framework uses the sliding expiration parameter.
I mean at wich point in the request lifecycle: http://msdn.microsoft.com/en-us/library/bb470252.aspx
If you fire the redirect before that point it's not added, BUT it should be in the next page. Try this, do the redirect after the half has we explained before, THEN when the new page appears, hit refresh on the browser to reload the new page and see if the cookie is there.
VishalNahar
None
0 Points
36 Posts
Re: on respone.redirect the cookies expier in the timout mentioned rather then sliding effect.
May 22, 2012 06:45 AM|LINK
I do a redirection from default page's page_load event and I am using custom forsauthentication.
doing a redirection after the half time is not the final solution.