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. how can recognize in asp.net when user exit from a page ?

how can recognize in asp.net when user exit from a page ?

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netdatabasehelpquestion
4 Posts 3 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.
  • B Offline
    B Offline
    B A
    wrote on last edited by
    #1

    hi in one of my webform's project , user can select some choice from a list. after each select, that item insert into a temp table in my database. and ... at last ,if user click ok button ,all selected things insert into main table. if page closed or exit with any reason before user click ok or cancel button , in code temp table must be clear. my problem is can not find any thing such as an event for times when user exit from the page. how can recognize in asp.net when user exit from a page ? tanks

    C J 2 Replies Last reply
    0
    • B B A

      hi in one of my webform's project , user can select some choice from a list. after each select, that item insert into a temp table in my database. and ... at last ,if user click ok button ,all selected things insert into main table. if page closed or exit with any reason before user click ok or cancel button , in code temp table must be clear. my problem is can not find any thing such as an event for times when user exit from the page. how can recognize in asp.net when user exit from a page ? tanks

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

      In ASP.NET, you can't, but you can write AJAX code that sends a message to the server when the browser is closed, and of course you can integrate this into your ASP.NET project, although it won't use any ASP.NET libraries or code behind ( unless you choose to emit your script in your code behind ).

      Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      B 1 Reply Last reply
      0
      • B B A

        hi in one of my webform's project , user can select some choice from a list. after each select, that item insert into a temp table in my database. and ... at last ,if user click ok button ,all selected things insert into main table. if page closed or exit with any reason before user click ok or cancel button , in code temp table must be clear. my problem is can not find any thing such as an event for times when user exit from the page. how can recognize in asp.net when user exit from a page ? tanks

        J Offline
        J Offline
        John ph
        wrote on last edited by
        #3

        To handle the Browser close event you will have to write a javascript function that handles it and call the function on the OnBeforeUnload client event.

        Regards
        J O H N :rose:
        "Even eagles need a push." David McNally


        1 Reply Last reply
        0
        • C Christian Graus

          In ASP.NET, you can't, but you can write AJAX code that sends a message to the server when the browser is closed, and of course you can integrate this into your ASP.NET project, although it won't use any ASP.NET libraries or code behind ( unless you choose to emit your script in your code behind ).

          Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

          B Offline
          B Offline
          B A
          wrote on last edited by
          #4

          tanks. exactly this solution was in my mind. and now found is right

          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