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. Session_end or browser close events?

Session_end or browser close events?

Scheduled Pinned Locked Moved ASP.NET
databasequestionhelp
4 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.
  • T Offline
    T Offline
    TintinV3ck
    wrote on last edited by
    #1

    Hi, On a site where users log in with username and password. How do I force a logout event to run before the application closes OR BROWSER IS CLOSED? I know about session_end, but that doesnt help when the browser is just closed! I really need to run an event to do a DB query before a user loggs out! Please help. Regards, Tintin

    E G 2 Replies Last reply
    0
    • T TintinV3ck

      Hi, On a site where users log in with username and password. How do I force a logout event to run before the application closes OR BROWSER IS CLOSED? I know about session_end, but that doesnt help when the browser is just closed! I really need to run an event to do a DB query before a user loggs out! Please help. Regards, Tintin

      E Offline
      E Offline
      enjoycrack
      wrote on last edited by
      #2

      Not sure got your clue... But if you just want to close the user session, just simple call Session.Abandon()... << >>

      1 Reply Last reply
      0
      • T TintinV3ck

        Hi, On a site where users log in with username and password. How do I force a logout event to run before the application closes OR BROWSER IS CLOSED? I know about session_end, but that doesnt help when the browser is just closed! I really need to run an event to do a DB query before a user loggs out! Please help. Regards, Tintin

        G Offline
        G Offline
        Guffa
        wrote on last edited by
        #3

        There is not sure way to do that. You can catch the onunload event in the browser, and open a new window that will run a page where you can do your database work. Of course that doesn't work if Javascript is disabled in the browser, or if a popup blocker stops the window. Unless the browser tells the server that it's closing, there is no way that the server can know when the browser closes. The closest thing that you can get is to have the web page send requests to the server at a certain interval, so that the server can detect when there are not coming any request any more. --- b { font-weight: normal; }

        C 1 Reply Last reply
        0
        • G Guffa

          There is not sure way to do that. You can catch the onunload event in the browser, and open a new window that will run a page where you can do your database work. Of course that doesn't work if Javascript is disabled in the browser, or if a popup blocker stops the window. Unless the browser tells the server that it's closing, there is no way that the server can know when the browser closes. The closest thing that you can get is to have the web page send requests to the server at a certain interval, so that the server can detect when there are not coming any request any more. --- b { font-weight: normal; }

          C Offline
          C Offline
          cloudking11966
          wrote on last edited by
          #4

          Guffa can u please postthe code to check "send requests to the server at a certain interval, so that the server can detect when there are not coming any request any more" Is it Submit page through Java Script at certain interval?

          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