title: Session variable and Masterpages
body: <p>I want to log a users session on my site. I was hoping to just set a session variable. But the initialisation of it is giving me problems.</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      if (Session["SESSION_GUID"] == null)
      {
          Session["SESSION_GUID"] = Guid.NewGuid().ToString();
          Response.Redirect(Request.Url.ToString(), true);
          return;
      }
      lnkUpload.Visible =  (Session["LOGGED_IN"] != null);
      btnLogout.Visible = (lnkUpload.Visible);
  }
  </code></pre>
  
  <p>It seems that the masterpage is creating the variable OK, but the rest of the pages load (ones using that master page). So in my log, I am seeing TWO hits. One with no session ID set, and the second hit has a session id.</p>
  
  <p>Any idea why the child page of this masterpage is loading twice? This only happens on the first request to the site. After that, the session is working fine and we only get one hit.</p>