Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Logout Automatically

Logout Automatically

Scheduled Pinned Locked Moved ASP.NET
csharphelpquestionasp-netvisual-studio
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Abubakarsb
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups