title: How to prompt the user when Session times out
body: <p>In my application when <code>sessionState</code> times out, it doesn't respond to the requests. So basically I want to know what is the best practice to handle this situation</p>
  
  <p>a) I want to prompt the user that session has timed out</p>
  
  <p>b) Then I want to take the user to the <code>Home</code> Page.</p>
  
  <p>Currently, I am doing it in every ajax requests <code>error</code> function by checking the status code:</p>
  
  <pre><code>$.ajax({
      url: urlOfferDetails,
      type: 'POST',
      data: { 'offerID': Offercode },
      success: function (data) {
          $("#loading").hide();
          },
      error: function (req, status, xhr) {
          if (req.status == 500) {
          alert('Session expired');
          }
      },
      complete: function () {
          $('.scrollup').fadeOut();
          }
      });
  }
  </code></pre>
  
  <p>Is it a good practice, to check for it in every requests? is there any general way to do this for all requests?</p>