title: variable in the MasterPage.master is not working properly
body: <p>I got a menu which I have a condition either the user is log in or not to the site therefore some option are not showing up if the user is not log in to the site (option C).</p>
  
  <p>Code from the MasterPage.master</p>
  
  <pre><code>&lt;div id="menu"&gt; 
     &lt;ul id="menua"; class="ul menua"&gt;
        &lt;li&gt;&lt;a href="../pages/OptionA.aspx"&gt;Option A&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="../pages/OptionB.aspx"&gt;Option B&lt;/a&gt;&lt;/li&gt;
        &lt;% if(userIdAuthenticated) {  %&gt;
              &lt;li&gt;&lt;a href="../pages/OptionC.aspx"&gt;Option C&lt;/a&gt; &lt;/li&gt;'
        &lt;% } %&gt; 
     &lt;/ul&gt;
  &lt;/div&gt; 
  </code></pre>
  
  <p>In the codebehing of the master page I just pass the bool Session variable to say if the user has been authorize or not.</p>
  
  <p>Code from MasterPage.master.cs</p>
  
  <pre><code>public partial class MasterPage : System.Web.UI.MasterPage
  {
      public bool userIdAuthenticated ;
  
      protected void Page_Load(object sender, EventArgs e)
      {
          bool userIdAuthenticated = Convert.ToBoolean(Session["userIdAuthenticated"]);
      }
  }
  </code></pre>
  
  <p>In the login page.cs  I just initalize the bool session variable to true if user has enter is credential properly.</p>
  
  <pre><code>bool buserIdAuthenticated = false;
  bool result = pwdManager.IsPasswordMatch(txtMotPasse.Text, sqlReader["salt"].ToString(),  
       sqlReader["hash"].ToString());
  if (result == true)
     {
         buserIdAuthenticated = true;
         Session["userIdAuthenticated"] = buserIdAuthenticated;
         Response.Redirect("default.aspx");
  </code></pre>
  
  <p>When I debug the code, everything is fine until I go back to the Master.master then the variable is back to false and I really don't understand from where it turn back to false because when I moved it from the Session variable it is set to true.
  Thanks for your help.</p>