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. Logged in and logged out.

Logged in and logged out.

Scheduled Pinned Locked Moved ASP.NET
debuggingquestionannouncement
12 Posts 5 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.
  • 2 Offline
    2 Offline
    2489128
    wrote on last edited by
    #1

    In my aplication I've to trace logged in and logged out for an user. I've created a table that contains information about logged in and logged out time of an user. whenever an user logged in i simply add a record in this table and when user logged out i simply update this table. now suppose that when a user close its browser by clicking on cross icon of browser or after a session time out then in this case user logically time out. then in this case how i update table for user logged out?

    A S 2 Replies Last reply
    0
    • 2 2489128

      In my aplication I've to trace logged in and logged out for an user. I've created a table that contains information about logged in and logged out time of an user. whenever an user logged in i simply add a record in this table and when user logged out i simply update this table. now suppose that when a user close its browser by clicking on cross icon of browser or after a session time out then in this case user logically time out. then in this case how i update table for user logged out?

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

      Handle the Browser Close using Java script, Open a popup on Browser close and in the code behind, do the server side stuff for update the data and then close the popup. This will resolve your issue.

      cheers, Abhijit CodeProject MVP Web Site:abhijitjana.net

      2 P 2 Replies Last reply
      0
      • 2 2489128

        In my aplication I've to trace logged in and logged out for an user. I've created a table that contains information about logged in and logged out time of an user. whenever an user logged in i simply add a record in this table and when user logged out i simply update this table. now suppose that when a user close its browser by clicking on cross icon of browser or after a session time out then in this case user logically time out. then in this case how i update table for user logged out?

        S Offline
        S Offline
        saanj
        wrote on last edited by
        #3

        Check out the link : http://www.codingforums.com/showthread.php?t=37279[^]

        Either you love IT or leave IT...

        1 Reply Last reply
        0
        • A Abhijit Jana

          Handle the Browser Close using Java script, Open a popup on Browser close and in the code behind, do the server side stuff for update the data and then close the popup. This will resolve your issue.

          cheers, Abhijit CodeProject MVP Web Site:abhijitjana.net

          2 Offline
          2 Offline
          2489128
          wrote on last edited by
          #4

          How can I Handle the Browser Close using Java script? plz help me.

          A 1 Reply Last reply
          0
          • 2 2489128

            How can I Handle the Browser Close using Java script? plz help me.

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

            2489128 wrote:

            How can I Handle the Browser Close using Java script? plz help me.

            function DeleteUserLog()
            {

                  if(window.event.clientX < 0 && window.event.clientY <0)
                   {
                    window.open("CloseSession.aspx", "OpenWindow\_Close\_Session",'left=12000,top=1200,width=10,height=1');
                   }
             }
            

            and on CloseSession.aspx page do the staff.

            cheers, Abhijit CodeProject MVP Web Site:abhijitjana.net

            modified on Friday, May 1, 2009 5:42 AM

            2 1 Reply Last reply
            0
            • A Abhijit Jana

              2489128 wrote:

              How can I Handle the Browser Close using Java script? plz help me.

              function DeleteUserLog()
              {

                    if(window.event.clientX < 0 && window.event.clientY <0)
                     {
                      window.open("CloseSession.aspx", "OpenWindow\_Close\_Session",'left=12000,top=1200,width=10,height=1');
                     }
               }
              

              and on CloseSession.aspx page do the staff.

              cheers, Abhijit CodeProject MVP Web Site:abhijitjana.net

              modified on Friday, May 1, 2009 5:42 AM

              2 Offline
              2 Offline
              2489128
              wrote on last edited by
              #6

              thanks. on which event will i have to call method DeleteUserLog?

              A 1 Reply Last reply
              0
              • 2 2489128

                thanks. on which event will i have to call method DeleteUserLog?

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

                if you have the master page you can call it on Body Unload if you dont have the master page you have to give it on body unload of all form (If page number is very less ) other wise developed a Handler to do the stuff. Cheers !!

                cheers, Abhijit CodeProject MVP Web Site:abhijitjana.net

                2 1 Reply Last reply
                0
                • A Abhijit Jana

                  Handle the Browser Close using Java script, Open a popup on Browser close and in the code behind, do the server side stuff for update the data and then close the popup. This will resolve your issue.

                  cheers, Abhijit CodeProject MVP Web Site:abhijitjana.net

                  P Offline
                  P Offline
                  Paddy Boyd
                  wrote on last edited by
                  #8

                  Unless they have popups blocked?

                  J 1 Reply Last reply
                  0
                  • P Paddy Boyd

                    Unless they have popups blocked?

                    J Offline
                    J Offline
                    Jeff Circeo
                    wrote on last edited by
                    #9

                    never trust that your popup will go though use a web service or a hidden iframe ... free hand didn't test this code var iframe = docuemnt.createElement("iframe") docuemnt.body.appendChild(iframe); iframe.setAttribute("src", "logOut.aspx");

                    Take a look at my corner of the net at Code Research Center

                    2 1 Reply Last reply
                    0
                    • A Abhijit Jana

                      if you have the master page you can call it on Body Unload if you dont have the master page you have to give it on body unload of all form (If page number is very less ) other wise developed a Handler to do the stuff. Cheers !!

                      cheers, Abhijit CodeProject MVP Web Site:abhijitjana.net

                      2 Offline
                      2 Offline
                      2489128
                      wrote on last edited by
                      #10

                      hi. i have put this code in window.onload event: window.event.clientX < 0 && window.event.clientY <0 and on clicking browser's close button we always find window.event.clientY < 0 and window.event.clientX > 0. so i'm unable to track browser's close event.

                      1 Reply Last reply
                      0
                      • J Jeff Circeo

                        never trust that your popup will go though use a web service or a hidden iframe ... free hand didn't test this code var iframe = docuemnt.createElement("iframe") docuemnt.body.appendChild(iframe); iframe.setAttribute("src", "logOut.aspx");

                        Take a look at my corner of the net at Code Research Center

                        2 Offline
                        2 Offline
                        2489128
                        wrote on last edited by
                        #11

                        could u provide code for it?

                        J 1 Reply Last reply
                        0
                        • 2 2489128

                          could u provide code for it?

                          J Offline
                          J Offline
                          Jeff Circeo
                          wrote on last edited by
                          #12

                          add the code from my last post the window.onbeforeunload event

                          Take a look at my corner of the net at Code Research Center

                          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