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. Twice Login

Twice Login

Scheduled Pinned Locked Moved ASP.NET
helptutorial
7 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.
  • I Offline
    I Offline
    i gr8
    wrote on last edited by
    #1

    If same user logging in twice, Make his 1st attempt to log-out how to handle this. Any help

    A 1 Reply Last reply
    0
    • I i gr8

      If same user logging in twice, Make his 1st attempt to log-out how to handle this. Any help

      A Offline
      A Offline
      Abhijit Jana
      wrote on last edited by
      #2

      You can maintain a database for logged in user. While new user logging in check with the DB for the same user are already logged in or not, if yes show him a message that some one has already logged in using same credentials. Thanks !

      I 1 Reply Last reply
      0
      • A Abhijit Jana

        You can maintain a database for logged in user. While new user logging in check with the DB for the same user are already logged in or not, if yes show him a message that some one has already logged in using same credentials. Thanks !

        I Offline
        I Offline
        i gr8
        wrote on last edited by
        #3

        Yes i thought of this. but logging out previous attempt would be better. any idea on that.

        A 1 Reply Last reply
        0
        • I i gr8

          Yes i thought of this. but logging out previous attempt would be better. any idea on that.

          A Offline
          A Offline
          Abhijit Jana
          wrote on last edited by
          #4

          You can. But for that each and every time you have to check with the Database or may be Cached data. You can try like that, Suppose below is your logged in table Structure

          M_ID M_Name M_Status
          101 Abhi 1
          102 Raj 1

          Now, M_Status ,1 Means these user are logged in. If some other user trying to logged in using same M_ID like 101, you just check your temp DB and and set M_Status=0 and insert a new record as below .

          M_ID M_Name M_Status
          101 Abhi 0
          102 Raj 1
          101 Jhon 1

          Now, who is already logged in ("Abhi") with the same ID ( 101 ) with M_Status=0 is need to be logged off from application. So, after that table should be like this,

          M_ID M_Name M_Status
          102 Raj 1
          101 Jhon 1

          Its means, if any point of time any M_Status=0, corresponding user need to be logged off from application. This is just an idea. You can think on that :)

          I 1 Reply Last reply
          0
          • A Abhijit Jana

            You can. But for that each and every time you have to check with the Database or may be Cached data. You can try like that, Suppose below is your logged in table Structure

            M_ID M_Name M_Status
            101 Abhi 1
            102 Raj 1

            Now, M_Status ,1 Means these user are logged in. If some other user trying to logged in using same M_ID like 101, you just check your temp DB and and set M_Status=0 and insert a new record as below .

            M_ID M_Name M_Status
            101 Abhi 0
            102 Raj 1
            101 Jhon 1

            Now, who is already logged in ("Abhi") with the same ID ( 101 ) with M_Status=0 is need to be logged off from application. So, after that table should be like this,

            M_ID M_Name M_Status
            102 Raj 1
            101 Jhon 1

            Its means, if any point of time any M_Status=0, corresponding user need to be logged off from application. This is just an idea. You can think on that :)

            I Offline
            I Offline
            i gr8
            wrote on last edited by
            #5

            i have used Application State and achieved. Thnks for u r suggestions

            A 1 Reply Last reply
            0
            • I i gr8

              i have used Application State and achieved. Thnks for u r suggestions

              A Offline
              A Offline
              Abhijit Jana
              wrote on last edited by
              #6

              If possible please provide some details of implementation, so that it can help some others :)

              I 1 Reply Last reply
              0
              • A Abhijit Jana

                If possible please provide some details of implementation, so that it can help some others :)

                I Offline
                I Offline
                i gr8
                wrote on last edited by
                #7

                MasterPageLoad

                Dim userId As String = Session("UserID")
                Dim multipleLogin As New Dictionary(Of String, String)()
                multipleLogin = New Dictionary(Of String, String)()
                Application.Lock()
                multipleLogin = DirectCast(Application("MultipleLogin"), Dictionary(Of String, String))
                If (multipleLogin.ContainsKey(userId)) Then
                Response.Output.Write("<script>alert(You have already signed in. Loggin out)</script>")
                Session.Clear()
                Response.Redirect("~/Login.aspx")
                End If

                    multipleLogin.Add(userId, Session.SessionID)
                    Application("MultipleLogin") = multipleLogin
                    Application.UnLock()
                
                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