Stai usando FormsAuthenticationTicket ?
Perchè fa tutto da solo
codice:
FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1,
tmpUser.Username,
DateTime.Now,
DateTime.Now.AddMinutes(30),
true,
"");
string encryptedTicket = FormsAuthentication.Encrypt(authTicket);
HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName,
encryptedTicket);
Response.Cookies.Add(authCookie);
Devi insererire nel web.config un paio di cosette:
codice:
<authentication mode="Forms">
<forms loginUrl="Login.aspx" name="LoginAuthCookie" timeout="30" path="/"></forms>
</authentication>
Appena il tempo da te configurato scade, l' utente viene dirotatto alla pagina di login.