title: How to check session is expired or not and redirect user to login page using javascript
body: <p>I am developing web application using ASP.Net MVC. In my application I am using some many ajax calls through out my application to Get/Post data for some functionality. For some functionality I am showing iframed popup. My issue is that when session is expired in my application I am redirecting user to login page but if user try to access functionality that opens in iframed popup instead of redirecting to login page my popup opens with login page inside it otherwise it's working properly. So what is best way to check session is expired or not and redirecting user to login page from inside of iframed popup. The code for opening iframed popup is as follow:</p>
  
  <pre><code>function ShowPopup(Url, DialogTitle, W, H) {
  
  /* Setting for dialog box */
  $("#dialog").dialog({
      title: DialogTitle,
      autoOpen: false,
      modal: true,
      resizable: false,
      width: W,
      height: H,
      open: function (ev, ui) {
          /* Setting URL to open in iframe */
          $('#ContentIframe').attr('src', Url);
      }
  });
  
  /* Opening dialog box */
  $('#dialog').dialog('open');
  }
  </code></pre>