In Asp.Net Forms Authentication, how can you specify the timeout property programmatically ?

 Posted by Akiii on 5/10/2012 | Category: ASP.NET Interview questions | Views: 3226 | Points: 40
Answer:

Timeout property programmatically :-

HttpCookie cookie  = FormsAuthentication.GetAuthCookie (txtUserName.Text, true);

' Expires in 30 days, 10 hours and 00 minutes from today.
cookie.Expires = DateTime.Now.Add(New TimeSpan(30, 10, 20, 0));
Response.Cookies.Add (cookie);
Response.Redirect (FormsAuthentication.GetRedirectUrl (txtUserName.Text, true));




Thanks and Regards
Akiii


| Alert Moderator 

Comments or Responses

Login to post response