AZGroups.com

Bringing together Arizona Technology Users And Enhancing the Careers of Developers
Welcome to AZGroups.com Sign in | Join | Help
in Search

Detecting Active Sessions

Last post 02-26-2008, 7:05 AM by aaroneden. 1 replies.
Sort Posts: Previous Next
  •  11-19-2007, 8:59 AM 865

    Detecting Active Sessions

    I've got an odd one.

    I need to be able to determine if a user's session is still active in memory. Here is the basic scenario.

    I have an app where users have fixed accounts, to which they can only have one active login at a time. As such, I need to be able to determine if a user tries to log in more than once at the same time. IE, they have shared their account with other people and they are all logging in at the same time.

     

    So, what I want to be able to do, is on login, check to see if that user account is already logged in, if I find an active session using that user ID, I would deny their login until the other session has expired. This of course requires that I be able to determine what session on the server are currently active.

    I know how to do this in other languages, such as JAVA and ColdFusion, they make it quite easy to access to access all of the active session underneath a single application, but I can't seem to find any parallel in .net.

     
    Has anyone approached this topic?

     

    =]

     

  •  02-26-2008, 7:05 AM 912 in reply to 865

    Re: Detecting Active Sessions

    This is actually not odd at all.  The fastest way to accomplish this is to use the global.asa file to tap into the Application_OnStart, Session_OnStart, etc events.  I'd recommend creating a table that tracks the active sessions and any important info about them.  It sounds like you could get away with just monitoring the sessionId and the user's login.  Then during login you check this table to look for the same user already being logged in.

     Keep in mind that there will be a (typically) 20 minute lag for users who just let their sessions time out and do not actually click "Log Out" (assuming you have a log out button or similar).

    Here is a tutorial that shows similar: http://aspnet101.com/aspnet101/tutorials.aspx?id=16 

     

    Good Luck,

    Aaron Eden

    Webglimmer Internet Solutions

    http://www.webglimmer.com/

    (866)WEB-GLIM (866-932-4546) x7069

    (520)204-1045 (Tucson) x7069

    (602)801-2277 (Phoenix) x7069

    (888)808-EDEN (3336) (Toll free, direct & fax)

     

     


    Aaron Eden
    Webglimmer Internet Solutions
    http://www.webglimmer.com/
    (866)WEB-GLIM (866-932-4546) x7069
    (520)204-1045 (Tucson) x7069
    (602)801-2277 (Phoenix) x7069
    (888)808-EDEN (3336) (Toll free, direct & fax)
    Filed under: ,
  • View as RSS news feed in XML
    Powered by Community Server, by Telligent Systems