title: How to restrict user to navigate back to previous pages and refresh?
body: <p>Currently I am trying to build a website using ASP.NET MVC5. 
  I am stuck.</p>
  
  <p>Issue: I want that when user goes to a particular page he/she should not be able to refresh the page, go back to the previous page, copy anything, print screen.</p>
  
  <p>Have tried different solutions like the followings:</p>
  
  <pre><code>window.onload = function () {
      if (typeof history.pushState === "function") {
          history.pushState("jibberish", null, null);
          window.onpopstate = function () {
              history.pushState('newjibberish', null, null);
              // Handle the back (or forward) buttons here
              // Will NOT handle refresh, use onbeforeunload for this.
          };
      }
      else {
          var ignoreHashChange = true;
          window.onhashchange = function () {
              if (!ignoreHashChange) {
                  ignoreHashChange = true;
                  window.location.hash = Math.random();
                  // Detect and redirect change here
                  // Works in older FF and IE9
                  // * it does mess with your hash symbol (anchor?) pound sign
                  // delimiter on the end of the URL
              }
              else {
                  ignoreHashChange = false;   
              }
           };
       }
  }
  </code></pre>
  
  <hr>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      window.onbeforeunload = function() {
          return "Dude, are you sure you want to leave? Think of the kittens!";
      }
  &lt;/script&gt;
  </code></pre>
  
  <hr>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  function disableF5(e) { if ((e.which || e.keyCode) == 116 || (e.which ||  e.keyCode) == 82) e.preventDefault(); };
  
  $(document).ready(function(){
       $(document).on("keydown", disableF5);
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>but nothing seem to work.</p>
  
  <p>Please suggest.</p>