title: ASP.NET Page_Unload to stop user from leaving page
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/147636/best-way-to-detect-when-user-leaves-a-web-page">Best way to detect when user leaves a web page</a>  </p>
  </blockquote>
  
  <p>I'm attemping to give a user the option to stay on the current page when they attempt to navigate away from it (if they have not saved changes to their progress). I'm unsure how to approach this as I have tried and failed JavaScript.</p>
  
  <p>I'm hoping there is a way inside the Page_Unload function in ASP.NET C# code.</p>
  
  <p>any help would be much appreciated.</p>