title: RoleManager and SimpleMembershipProvider cannot be used with AuthorizeAttribute
body: <p>I have an Asp.Net MVC 5 application. I want to use user roles to authorize only some people to use a specific action. I've changed my <code>Web.config</code> file like this:</p>
  <pre><code>&lt;roleManager enabled=&quot;true&quot;/&gt;
  &lt;membership defaultProvider=&quot;SimpleMembershipProvider&quot;&gt;
    &lt;providers&gt;
      &lt;clear/&gt;
      &lt;add name=&quot;SimpleMembershipProvider&quot; type=&quot;WebMatrix.WebData.SimpleMembershipProvider, WebMatrix.WebData&quot; /&gt;
    &lt;/providers&gt;
  &lt;/membership&gt;
  </code></pre>
  <p>This is how I add users to roles:</p>
  <pre><code>if (!await Roles.RoleExists(role))
      await Roles.CreateRole(new Role(role));
  await Roles.AddUserToRole(role, user.Id);
  </code></pre>
  <p>Currently I am able to access the roles for a user through code using something like this:</p>
  <pre><code>    public static async Task&lt;IEnumerable&lt;string&gt;&gt; GetUserRoles(string username)
      {
          if (string.IsNullOrEmpty(username))
              return new string[0];
          string userId = await Logins.GetUserId(IdentityConfig.LocalLoginProvider, username);
          var roles = await Roles.GetRolesForUser(userId);
          return roles;
      }
  </code></pre>
  <p>However, when I try to use the <code>Authorize</code> attribute to access the roles, the page will get stuck and nothing loads.</p>
  <pre><code>[Authorize(Roles = &quot;Admin&quot;)]
  public ActionResult Index()
  {
      return View(db.Restaurants.ToList());
  }
  </code></pre>
  <p>What am I doing wrong here?</p>
  <h3>Update:</h3>
  <p>After a while the webpage will show this error:</p>
  <p><img src="https://i.stack.imgur.com/kztc5.png" alt="Asp.Net error page" /></p>