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 I find user click Back Button at IE?

How can I find user click Back Button at IE?

Scheduled Pinned Locked Moved ASP.NET
questioncsharpasp-net
2 Posts 2 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.
  • D Offline
    D Offline
    Dong Kim
    wrote on last edited by
    #1

    When my asp.net code page open, there are 2 dataset object created. I need to dispose these datasets when user click back button. How can I find user click back button at IE menu? Please let me know.

    J 1 Reply Last reply
    0
    • D Dong Kim

      When my asp.net code page open, there are 2 dataset object created. I need to dispose these datasets when user click back button. How can I find user click back button at IE menu? Please let me know.

      J Offline
      J Offline
      Jesse Squire
      wrote on last edited by
      #2

      You cannot directly detect the press of any browser button. You do have a couple of options for cleaning up, however. First, in Global.asax, there is an event handler mapped for you called Session_End that will execute when the user's session expires. You could run your clean-up code there. You could instead store your dataset objects in the Cache object of the current Http context. By doing so, you could set some cache policies that would be more aggressive in expiring the items. Note that this cache is shared accross user sessions, so you would want to use a key that is unique, such as Session.SessionId, to prevent sessions from interacting. Another option is to use javascript to handle the onunload event for the body object. You could send an asynchronous request to a web service method on the server to perform your clean-up code for you. Note that the unload event will run whenever the page is unloaded from the browser, including when you perform a postback or navigate to another page in your site, so it can be difficult to determine when, exactly, you want to run your clean-up. I hope that helps to get you started. :)

      --Jesse

      "... the internet's just a big porn library with some useful articles stuck in." - Rob Rodi

      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