title: Hide Menu option based on Role Visual Studio 2013 asp.net web site
body: <p>When creating a standard asp.net web site with vs2013 I notice that no site map is used and I also note that the menu created  is a new nav bar class.</p>
  
  <p>You get this as a default:</p>
  
  <pre><code>            &lt;div class="navbar-collapse collapse"&gt;
                  &lt;ul class="nav navbar-nav"&gt;
                      &lt;li&gt;&lt;a runat="server" href="~/"&gt;Home&lt;/a&gt;&lt;/li&gt;
                      &lt;li&gt;&lt;a runat="server" href="~/About"&gt;About&lt;/a&gt;&lt;/li&gt;
                      &lt;li&gt;&lt;a runat="server" href="~/Contact"&gt;Contact&lt;/a&gt;&lt;/li&gt;
                      &lt;li&gt;&lt;a runat="server" href="~/Upload"&gt;Upload Files&lt;/a&gt;&lt;/li&gt;
                      &lt;li&gt;&lt;a runat="server" href="~/Portal/UploadCust"&gt;Customer Portal&lt;/a&gt;&lt;/li&gt;
                  &lt;/ul&gt;
  </code></pre>
  
  <p>So, no site map is used here. And the menu system in asp.net NOW does not use the site.map. What is the suggested approach NOW THAT NO SITEMAP is used in these templates to hide a given menu based on role?</p>
  
  <p>Is the suggestion to create a sitemap by hand? and then simply enable trimming as was done in the past?  I have role permissions working fine (sql providers) but I am perplexed why this new menu system does not support nor have anything to do with site maps? I am simply looking to hide menu options based on role membership but am at a loss as to why the default menu systems don't use sitemap anymore? Right now users just get a 404 error.</p>
  
  <p>So is some suggested way to hide menu options in above or is it still best to adopt a site map and enable trimming? This being the case then must I drop use of the above new nav bar class?</p>
  
  <p>edit:my current solution is to add a id like this </p>
  
  <pre><code>"&lt;a id="PortalLink" runat="server" href="~/Portal/UploadCust"&gt;Customer Portal&lt;/a&gt;
  </code></pre>
  
  <p>And then in the web site on-load in VB, I use this:</p>
  
  <pre><code>    If Roles.IsUserInRole("Portal") Then
          Me.PortalLink.Visible = True
      Else
          Me.PortalLink.Visible = False
      End If
  </code></pre>