title: How can I write and read bool values into/from cookies?
body: <p>I want to save the state of checkboxes in an html form on submit to cookies, and then enable/disable other parts of my site based on those cookie values.</p>
  
  <p>I've started out with code like this:</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;form method="POST"&gt;
      &lt;fieldset&gt;
          &lt;legend&gt;(Not really) Opt In or Out&lt;/legend&gt;
          &lt;input type="checkbox" id="selectTwitter" name="selectTwitter" &gt;I'm Twitterpated!&lt;/input&gt;&lt;br /&gt;
  </code></pre>
  
  <p>. . .
          
      </p>
  
  <p>Razor:</p>
  
  <p>@{
      var twitterSelected = false;
      . . .</p>
  
  <pre><code>if (IsPost)
  {
      twitterSelected = Request["selectTwitter"].AsBool();
      Response.Cookies["TwitterSelected"].Value = twitterSelected.ToString(); // Doesn't seem to accept saving boolean vals - saved as "false" or "true"?
      Response.Cookies["TwitterSelected"].Expires = DateTime.Now.AddYears(1);
  . . .
  </code></pre>
  
  <p>...but am stuck on how to check or uncheck the checkboxes based on possibly existing cookie vals:</p>
  
  <pre><code>if (Request.Cookies["selectTwitter"] != null)
  {
      // what now?
  }
  </code></pre>