Logout Automatically
-
Hi, I posted this kind of thread a few days before as well although I got replies but unfortunately my problem is still there so here I am repeating my question. My requirement is that when user closes the browser window it should logout autmatically. The problem is that I am new in Visual Studio 2005 (Asp.net 2.0) and a developer already made this, I am just updating it. I don't have any idea how new login system works in VS2005. I really don't know how he is storing or checking that whether user is login or not? I have found following code in commonMaster page. if (Properties.IsLoggedIn) { string cookieName = FormsAuthentication.FormsCookieName; HttpCookie authCookie = Context.Request.Cookies[cookieName]; FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(authCookie.Value); MembershipUser mu = Membership.GetUser(); Properties.EndUserGUID = mu.ProviderUserKey.ToString().ToUpper(); DateTime expiration = authTicket.Expiration.AddSeconds(-90); if (expiration < DateTime.Now) { mu.LastLoginDate = DateTime.Now; Membership.UpdateUser(mu); FormsAuthentication.SetAuthCookie(Context.User.Identity.Name, true, "/"); } } If anybody knows about it please help me! Thanks. Bye.