title: Cookie only displayed on refresh?
body: <p>I have some trouble understanding this one so here it is. </p>
  
  <p><strong>I'm trying to set a cookie and display the value on the page using ASP.NET + C#.</strong> </p>
  
  <p>here's my code:</p>
  
  <pre><code>protected void lbChangeToSmall_Click(object sender, EventArgs e)
          {
              Response.Cookies["fontSize"].Value = "small";
          }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>&lt;asp:LinkButton runat="server" id="lbChangeToSmall" Text="A" CssClass="txt-sm" OnClick="lbChangeToSmall_Click"&gt;&lt;/asp:LinkButton&gt;
  </code></pre>
  
  <p>And finally</p>
  
  <pre><code> protected void Page_Load(object sender, EventArgs e)
          {
              if (!IsPostBack)
              {
                  Response.Write( Request.Cookies["fontSize"].Value);
              }
  
          }
  </code></pre>
  
  <p>When I click on the button, nothing is displayed on the page, but the cookie is actually set. If I refresh the page, the cookie displays.</p>
  
  <p>So it seems that the cookie is set correctly but the application is not able to read it right away.</p>
  
  <p>I tried to get rid of the if(postBack):</p>
  
  <pre><code> protected void Page_Load(object sender, EventArgs e)
          {
                  Response.Write( Request.Cookies["virgilFontSize"].Value);
          }
  </code></pre>
  
  <p>but it didn't change a thing.</p>
  
  <p>What am I doing wrong?</p>
  
  <p>Thanks!</p>