title: Redirecting to a page in MasterPage when Authenticaion Fails not working
body: <p>For my web application I am using Windows Authentication. I have written the following code in the <code>Session_Start</code> event of Global.asax page; if the logged in user is valid I am storing those details in session as such</p>
  
  <pre><code>Session["UserDetails"] = "XXXX";
  </code></pre>
  
  <p>If the user is not valid then</p>
  
  <pre><code>Session["UserDetails"] = null;
  </code></pre>
  
  <p>Then in my MasterPage, I use the following code </p>
  
  <pre><code>if(!IsPostBack)
  { 
      if(Session["UserDetails"] == null)
      {
          Response.Redirect("AuthenticationFailure.aspx");
      }
  }
  </code></pre>
  
  <p>But, it is not redirecting to that particular failure page. When I check the same condition in each and every aspx page load it seems to be working fine, but the page is not redirected.</p>
  
  <p>What could be going wrong here? How should I redirect to the AuthenticationFailure page in order for it to work?</p>