Logout User on Windows close....

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • malav123
    New Member
    • Feb 2008
    • 217

    Logout User on Windows close....

    Hi,

    I want to implement such a functionality in my project that whenever user is login and if he closes the window without logout then he should be logout and i also wants to change the status in database at a time.. i have tried the onunload and onbeforeunload but it affects only after timeout session period that is after 20 minutes... so how to implement this please give me suggestion... i m waiting.....

    thanks in advance...


    -malav.
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    See your previous thread on the exact same matter:

    Comment

    • malav123
      New Member
      • Feb 2008
      • 217

      #3
      Originally posted by Plater
      See your previous thread on the exact same matter:
      http://bytes.com/forum/thread794330.html


      HI plater,
      I know that i have posted same thing before but still my problem is not solved, i also tried onbeforeunload but still the status changes only after session timeout period that is after 20 minutes... so what is the solution of that ???

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        Well what are you doing with your ununload function?
        Are you sending a message back to your server telling them to Session.Abandon ()?

        Comment

        • malav123
          New Member
          • Feb 2008
          • 217

          #5
          Originally posted by Plater
          Well what are you doing with your ununload function?
          Are you sending a message back to your server telling them to Session.Abandon ()?

          HI,
          I m calls one javascript function "onunload" event.. and from that i calls "PageMethods.Ab andonSession(); " and i have write code in global.asax in session end but the code always executes after session timeout that is after 20 minutes so what is the problem ???

          Comment

          • Frinavale
            Recognized Expert Expert
            • Oct 2006
            • 9749

            #6
            Originally posted by malav123
            HI,
            I m calls one javascript function "onunload" event.. and from that i calls "PageMethods.Ab andonSession(); " and i have write code in global.asax in session end but the code always executes after session timeout that is after 20 minutes so what is the problem ???
            You can't use the "onunload" event because then the page is completely unloaded and it can no longer send anything to the server.

            You have to use the "onbeforeunload " event to make an Ajax call to the server that will log out the user.

            I explained this in your other thread...do you understand what I'm trying to say?

            -Frinny

            Comment

            • malav123
              New Member
              • Feb 2008
              • 217

              #7
              Originally posted by Frinavale
              You can't use the "onunload" event because then the page is completely unloaded and it can no longer send anything to the server.

              You have to use the "onbeforeunload " event to make an Ajax call to the server that will log out the user.

              I explained this in your other thread...do you understand what I'm trying to say?

              -Frinny

              Hi Frinny,

              I also used "onbeforeunload " but still my problem is there as unsolved... i know you have give me suggestion on same related post but still at a time i don't get status change... so what is solution ??? i want to implement this functionality in my project... so please suggest me... waiting for your response....


              -malav.

              Comment

              • CyberSoftHari
                Recognized Expert Contributor
                • Sep 2007
                • 488

                #8
                Originally posted by malav123
                ... so what is solution ??? ...
                -malav.
                Do not let us assume. It will be helpful, only you post what you had tried so for.
                Note : Do not post all code in a class, Just post that method.

                Comment

                • malav123
                  New Member
                  • Feb 2008
                  • 217

                  #9
                  Originally posted by CyberSoftHari
                  Do not let us assume. It will be helpful, only you post what you had tried so for.
                  Note : Do not post all code in a class, Just post that method.

                  Hi,
                  In my master page, i calls following javascript function on "onbeforeunload " event....
                  Code:
                  function HandleClose()  
                      {
                           alert("Killing the session on the server!!");
                           PageMethods.AbandonSession();
                          
                      }
                  and i have written sql statement in global.asax to change the status... but it changes after 20 minutes that is the session timeout period...

                  Comment

                  • CyberSoftHari
                    Recognized Expert Contributor
                    • Sep 2007
                    • 488

                    #10
                    Hope I had given a reasonable page. Go through this Auto Logout when the application browser closed? thread and try.

                    Comment

                    • Plater
                      Recognized Expert Expert
                      • Apr 2007
                      • 7872

                      #11
                      And for PageMethods.Aba ndonSession(); you have setup the correct ajax functionality to perform this? (I had to look that up, found this: http://aspalliance.com/1294_CodeSnip...e_ServerSide.3

                      Comment

                      • malav123
                        New Member
                        • Feb 2008
                        • 217

                        #12
                        Originally posted by Plater
                        And for PageMethods.Aba ndonSession(); you have setup the correct ajax functionality to perform this? (I had to look that up, found this: http://aspalliance.com/1294_CodeSnip...e_ServerSide.3


                        Hi plater,
                        I already refer this site... in fact i follows the logic described in this site... but still there is no desired solution... as you told i have to setup the correct ajax functionality to accomplish this.. so what i have to do for that....?

                        Comment

                        • malav123
                          New Member
                          • Feb 2008
                          • 217

                          #13
                          Originally posted by Plater
                          And for PageMethods.Aba ndonSession(); you have setup the correct ajax functionality to perform this? (I had to look that up, found this: http://aspalliance.com/1294_CodeSnip...e_ServerSide.3
                          Hi plater,
                          I already refer this site... in fact i follows the logic described in this site... but still there is no desired solution... as you told i have to setup the correct ajax functionality to accomplish this.. so what i have to do for that....?

                          Comment

                          • Plater
                            Recognized Expert Expert
                            • Apr 2007
                            • 7872

                            #14
                            Have you implemented the examples developed on that link? Do they work? Can you modify them to fit your needs?

                            Comment

                            • malav123
                              New Member
                              • Feb 2008
                              • 217

                              #15
                              Originally posted by Plater
                              Have you implemented the examples developed on that link? Do they work? Can you modify them to fit your needs?
                              Yes i have tried same example given in that link and i also modified it according to my needs... but still i gets status change after 20 minutes... not at a time... so where is the problem ???

                              Comment

                              Working...