title: How do you disable a MenuItem if a user is not logged in?
body: <p>How do I disable an  if the user is not logged in?</p>
  
  <pre><code>&lt;asp:MenuItem NavigateUrl="~/Customizations.aspx" Text="Customizations" Enabled="&lt;%# Page.User.Identity.IsAuthenticated %&gt;" /&gt;
  </code></pre>
  
  <p>Doesn't work, even if I specify Page.DataBind() in the Page_Load method.</p>
  
  <pre><code>&lt;% if (HttpContext.User.Identity.IsAuthenticated) { %&gt;
      &lt;asp:MenuItem NavigateUrl="~/Customizations.aspx" Text="Customizations" /&gt;
  &lt;% } %&gt;
  </code></pre>
  
  <p>Gives the error: Parser Error Message: Code blocks are not supported in this context.</p>
  
  <p>I tried adding an ID attribute, and it gives an error saying it isn't a supported attribute.</p>
  
  <p>Any ideas?</p>