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. Signout my webpage

Signout my webpage

Scheduled Pinned Locked Moved ASP.NET
csharpasp-nettutorialquestion
3 Posts 3 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.
  • S Offline
    S Offline
    SathyaSiva
    wrote on last edited by
    #1

    The user sign in to my website without sign out enter into another site (type address in address bar). For this situation I want to logout my website. How to do this? I am using ASP.NET 2.0 with C#

    E J 2 Replies Last reply
    0
    • S SathyaSiva

      The user sign in to my website without sign out enter into another site (type address in address bar). For this situation I want to logout my website. How to do this? I am using ASP.NET 2.0 with C#

      E Offline
      E Offline
      eyeseetee
      wrote on last edited by
      #2

      I don't think there is an easy way to do this as there would be no way of running a bit of code to detect this

      1 Reply Last reply
      0
      • S SathyaSiva

        The user sign in to my website without sign out enter into another site (type address in address bar). For this situation I want to logout my website. How to do this? I am using ASP.NET 2.0 with C#

        J Offline
        J Offline
        Jesse Squire
        wrote on last edited by
        #3

        There are a few ways that you could go about doing this, each with their own set of trade-offs. The first couple that come to mind for me are: Use the built-in ASP.NET session management and force your logout code to run when the session expires (see the Session_End handler in global.asax. The default session expiration is a 20 minute sliding timer from the last request/response activity. This number can be tuned to your liking, but remember that it will effect a user that leaves their browser idle as well as one that actively browsed away from your site. Another possibility is to use a session-based cookie (reference[^]) to signify that a user has logged into your site and use the unload event of the window object (reference[^]) in client script to force your logout code to run. The downside here is that you would be logging the user out each time they navigated from page-to-page, even within your site and you would have to read the cookie to verify that they're authenticated to your site and run your login code each time. The result is rather messy, as your login and logout code are running for each page of your site. The user would also be able to leave your site and return still authenticated until they closed their browser. My recommendation would be to consider the first technique of using the built-in session. Unless you have extremely sensitive content or logout code that absolutely must run immediately, I find that the session is usually a good trade-off. Hope that helps a bit to get you started. :)

        --Jesse

        "... the internet's just a big porn library with some useful articles stuck in." - Rob Rodi

        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