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. Log out in closing

Log out in closing

Scheduled Pinned Locked Moved ASP.NET
6 Posts 4 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.
  • A Offline
    A Offline
    ahmed eldeghedy
    wrote on last edited by
    #1

    hi i need to log out when the user close the explorer by click (X)button

    ahmed eldeghedy

    B A C 3 Replies Last reply
    0
    • A ahmed eldeghedy

      hi i need to log out when the user close the explorer by click (X)button

      ahmed eldeghedy

      B Offline
      B Offline
      Brij
      wrote on last edited by
      #2

      You can capture the event when user closes the browser in Javascript,and from that you can call some server side code to logout from the session. One thing,if you close the browser then also after sesstionout time user automatically logs out.So if no specific requirement like secuirty or some logs for it,then you can use above one else you don't need to care about it.

      Cheers!! Brij

      1 Reply Last reply
      0
      • A ahmed eldeghedy

        hi i need to log out when the user close the explorer by click (X)button

        ahmed eldeghedy

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

        ahmed eldeghedy wrote:

        i need to log out when the user close the explorer by click (X)button

        if(window.event.clientX < 0 && window.event.clientY <0)
                   {
                    Alert("Browser Closing");
                   }
        

        Call this from onunload of body :)

        cheers, Abhijit CodeProject MVP My Blog :Abhijit's World of .Net

        1 Reply Last reply
        0
        • A ahmed eldeghedy

          hi i need to log out when the user close the explorer by click (X)button

          ahmed eldeghedy

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          You can capture the event in js and use AJAX to tell your app that it happened. But even then, I would not trust it 100%, I would never write code that relies on the user logging out, I'd impliment a timeout for users who manage to leave my site without me knowing.

          Christian Graus Driven to the arms of OSX by Vista.

          A A 2 Replies Last reply
          0
          • C Christian Graus

            You can capture the event in js and use AJAX to tell your app that it happened. But even then, I would not trust it 100%, I would never write code that relies on the user logging out, I'd impliment a timeout for users who manage to leave my site without me knowing.

            Christian Graus Driven to the arms of OSX by Vista.

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

            Christian Graus wrote:

            I would not trust it 100%, I would never write code that relies on the user logging out, I'd impliment a timeout for users who manage to leave my site without me knowing.

            That's perfect :)

            cheers, Abhijit CodeProject MVP My Recent Article : Exploring Session in ASP.Net

            1 Reply Last reply
            0
            • C Christian Graus

              You can capture the event in js and use AJAX to tell your app that it happened. But even then, I would not trust it 100%, I would never write code that relies on the user logging out, I'd impliment a timeout for users who manage to leave my site without me knowing.

              Christian Graus Driven to the arms of OSX by Vista.

              A Offline
              A Offline
              ahmed eldeghedy
              wrote on last edited by
              #6

              in the first thank you i know what you speaking about but i am a developer not a customer and that a customer request and i can not change his beliefs note ---- the question not for log out specially i am sorry it for how to open connection with data base thanks for your help again

              ahmed eldeghedy

              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