title: Accessing a cookie value in an ASP.NET Core MVC Razor view
body: <p>I set a cookie using JavaScript when the user clicks a button:</p>
  
  <pre><code>document.cookie = "menuSize=Large";
  </code></pre>
  
  <p>I need to access this cookie in razor syntax so I can output the correct styles at the top of _Layout.cshtml every time the user changes pages:</p>
  
  <pre><code>    @{
          if (cookie == "Large")
          {
              &lt;style&gt;
  LARGE STYLES
              &lt;/style&gt;
          }
          else
          {
              &lt;style&gt;
  SMALL STYLES
              &lt;/style&gt;
          }
      }
  </code></pre>