T. R. Tinker:FormsAuthenticationTicket authTicket = new
FormsAuthenticationTicket(user.Id.ToString(), true);
string encryptedTicket = FormsAuthentication.Encrypt(authTicket);
HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
cookie.Expires = authTicket.Expiration;
HttpContext.Current.Response.Cookies.Set(cookie);
Response.Redirect(FormsAuthentication.GetRedirectUrl(user.Id.ToString(),false), true);
Hmm, what about manually set a cookie as authentication ticket like the following article does.
http://geekswithblogs.net/vivek/archive/2006/10/13/93956.aspx
Here is my steps
1, I only set 10 minutes for authentication timeout in web.config (will manually override this setting by code)
---------------web.config--------------
<forms timeout="10" loginUrl="login.aspx"></forms>
2. Use this code manualy set timeout to 30 minutes
FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket("MyUserName", true, 30); //should be same as cookie expiration
string encryptedTicket = FormsAuthentication.Encrypt(authTicket);
HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
authCookie.Expires = DateTime.Now.AddMinutes(30);//make sure its same as the formsauthentication ticket expiry value
HttpContext.Current.Response.Cookies.Add(authCookie);
Response.Redirect("default.aspx");
3. Then check if user is still authenticated within 30 minuste. Look forward to your reply
4, BTW: I test the above code without Login control in page.