I'm trying to write some code to warn the user when they are close to been logged out (Forms Authentication). Basically we have a form that could take longer than 20 mins to fill out especially if they walk away from the machine and come back. We don't want
them losing their data so i want to warn them. I think this warning would be useful across the whole app not just the form.
I'm using AjaxPro to make an ajax call to retrieve the number of minutes the user has before they are logged out which is working well but due to .net's sliding expiration the authentication ticket is been renewed when the ajax call is made when there is
10 or less minutes until expiry. I've tried clearing the response but the authentication ticket is still been updated.
Does anybody have any ideas on how to stop the authentication ticket from renewing when i make this ajax call? or maybe suggest another method. Code is below
marknz
0 Points
1 Post
Stop authentication ticket updating expiry on ajax call
Jan 09, 2009 01:34 AM|LINK
I'm trying to write some code to warn the user when they are close to been logged out (Forms Authentication). Basically we have a form that could take longer than 20 mins to fill out especially if they walk away from the machine and come back. We don't want them losing their data so i want to warn them. I think this warning would be useful across the whole app not just the form.
I'm using AjaxPro to make an ajax call to retrieve the number of minutes the user has before they are logged out which is working well but due to .net's sliding expiration the authentication ticket is been renewed when the ajax call is made when there is 10 or less minutes until expiry. I've tried clearing the response but the authentication ticket is still been updated.
Does anybody have any ideas on how to stop the authentication ticket from renewing when i make this ajax call? or maybe suggest another method. Code is below
[AjaxPro.AjaxMethod] public string GetTicketExpiryInMinutes() { HttpContext.Current.Response.Clear(); HttpContext.Current.Response.ClearContent(); HttpContext.Current.Response.ClearHeaders(); HttpContext.Current.Response.Cookies.Clear(); //HttpContext.Current.Response.SuppressContent = true; return ((FormsIdentity) HttpContext.Current.User.Identity).Ticket.Expiration.Subtract(DateTime.Now).Minutes.ToString(); }ryanw51
Contributor
2363 Points
511 Posts
Re: Stop authentication ticket updating expiry on ajax call
Apr 07, 2011 04:22 PM|LINK
Did you ever figure anything out? I'm having this exact problem myself.