aTekTipsUser
Programmer
In asp.net, I am trying to run code before leaving the page. I've tried using window.onbeforeunload to ask the user if they want to save. If they say yes, I mark a hidden checkbox, and re-submit the form. Then, on the page_load event, I check to see if the hidden checkbox is checked and if it is I save to the database. This worked fine running on my system, but when I posted it live on the web, it did not work, it did not update the database. Any ideas on how to save to a database before leaving the page? I want this code to run whenever the users click the x to close the window or the back button. Thanks in advance.