title: ASP.Net MVC Authentication - Hide Element in View based on roles
body: <p>Is there a possibility to hand over the Result of the Authorize-Attribute to the View?</p>
  
  <p>Let's assume I want to hide 5 links in my Index view based on the memberships of a User.</p>
  
  <pre><code>[Authorize(Roles = "Admin")]
  public ActionResult Index(){
      ....
  }
  </code></pre>
  
  <p>The code above will prevent all users that are not part of the Admin-Group from visiting the Index page.</p>
  
  <pre><code>@{
      if(User.IsInRole("Admin"){
          &lt;a href="#"&gt;Some link to be hidden&lt;/a&gt;
      }
  }
  </code></pre>
  
  <p>This code will hide the link if the User is not part of the Admin role. This is basically what I want BUT using this method I have to change the role name on every hidden link if the role would change.</p>
  
  <p>Isn't there something like a combination of both? (Schema see below)</p>
  
  <pre><code>[Authorize(Roles = "Admin")] //This will pass true to the View if the User is a member of the group "Admin"
  public ActionResult Index(){
      ....
  }
  
  @{
      if(User.IsAuthenticated){ //This will read the "Token" and if it's true the if statement will get executed.
          &lt;a href="#"&gt;Some link to be hidden&lt;/a&gt;
      }
  }
  </code></pre>
  
  <p>So - if the User is in Role "Admin" the link will be shown. Is this possible?</p>