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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Killing a remote application browser session from a new browser session.

Killing a remote application browser session from a new browser session.

Scheduled Pinned Locked Moved ASP.NET
csharpsecurityquestion
2 Posts 2 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
    Stephen Holdorf
    wrote on last edited by
    #1

    I have to write ASP .NET code that allows for a user to only have one application session active at a time. What the code needs to do is logout an existing user, or session, if the same user logs into the same application in a different browser. In other words the new session should kill the old or existing session. Has anyone done this before? One note is that I am using Windows authentication and not Forms.

    Richard DeemingR 1 Reply Last reply
    0
    • S Stephen Holdorf

      I have to write ASP .NET code that allows for a user to only have one application session active at a time. What the code needs to do is logout an existing user, or session, if the same user logs into the same application in a different browser. In other words the new session should kill the old or existing session. Has anyone done this before? One note is that I am using Windows authentication and not Forms.

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      holdorf wrote:

      One note is that I am using Windows authentication and not Forms.

      It's almost impossible to sign out if you're using Windows authentication. In most cases, the only way to accomplish it is to restart the browser. One possible option:

      • In a database, map the username to a Guid representing their "active session";
      • In the "authorize request" event, check for the existence of a custom cookie:
        • If the cookie exists, verify that its value matches the user's "active session" value in the database, and allow or deny the request as required;
        • If the cookie doesn't exist, change the user's "active session" value in the database, and set a session cookie on the response with the new value;

      Once a user has been kicked off by signing in on another browser or device, they will need to restart their browser to sign in again. NB: Certain browser settings may cause the browser to retain session cookies even after a restart, which would mean the user would have to manually clear the cookies for your site to sign in again. This affects both Chrome[^] and Firefox[^], and possibly others.


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      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