title: Automatically assign default role
body: <p>How is it possible the automatically assign a default role to a registered user. I'm trying this but it is not working and I'm getting the error:</p>
  
  <pre><code>[ProviderException: The role 'Member' was not found.]
  </code></pre>
  
  <p>This is what I do:</p>
  
  <p>Seed my default role so it exists from the start:</p>
  
  <pre><code>// Configuration.cs, Seed method.
  
  if (!context.Roles.Any(r =&gt; r.Name == "Member"))
  {
      var store = new RoleStore&lt;IdentityRole&gt;(context);
      var manager = new RoleManager&lt;IdentityRole&gt;(store);
      var role = new IdentityRole { Name = "Member" };
  
      manager.Create(role); // Member role gets created in AspNetRoles table.
  }
  </code></pre>
  
  <p>Than after update-database, I add a registered user to that role:</p>
  
  <pre><code>// AccountController, Register method (POST).
  
  var user = new ApplicationUser { ... }
  
  if (.. Succeeded)
  {
      ..
      if (!Roles.IsUserInRole(user.UserName, "Member"))
          Roles.AddUserToRole(user.UserName, "Member");
  
      return RedirectToAction("Index", "Home");
  }
  </code></pre>
  
  <p>When registering a new account, I get the error:</p>
  
  <pre><code>[ProviderException: The role 'Member' was not found.] // Member exits in AspNetRoles
  
  Line 176:                    if (!Roles.IsUserInRole(user.UserName, "Member"))
  Line 177:                         Roles.AddUserToRole(user.UserName, "Member");
  </code></pre>