private void SetAuthenticationCookie(Usuario usuario) { var ticket = new FormsAuthenticationTicket( 1, usuario.Codigo.ToString(), DateTime.Now, DateTime.Now.AddMinutes(FormsAuthentication.Timeout.TotalMinutes), false, usuario.ToString(), FormsAuthentication.FormsCookiePath ); var encryptedTicket = FormsAuthentication.Encrypt(ticket); var cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket) { HttpOnly = FormsAuthentication.RequireSSL, Path = FormsAuthentication.FormsCookiePath, Domain = FormsAuthentication.CookieDomain }; Response.AppendCookie(cookie); //FormsAuthentication.SetAuthCookie(usuario.User, false); }