I assume you created a new Web Forms project using the "Individual Account" option. This adds ASP.NET Identity to the project which is an API and Database for working with user accounts. The API is made up of several services to interact with the database. The template configures two of the services; SignInManager and UserManager.
There is a RoleManager for adding/updating/deleting roles in the Roles table. Not to be confused with adding Roles to User which is a UserManager feature. Typically applications only have a hand full of Roles which is a one time script to add the roles. These days Claims are used to describe a user which the UserManager handles.
Anyway, there are tons of ASP.NET Identity tutorials and blogs which is really your main question.
Introduction to ASP.NET Identity
Edit: code sample.
Add an ApplicationRoleManager class to the IdentityConfig.cs file.
public class ApplicationRoleManager : RoleManager<IdentityRole>
{
public ApplicationRoleManager(IRoleStore<IdentityRole, string> store) : base(store)
{
}
public static ApplicationRoleManager Create(IdentityFactoryOptions<ApplicationRoleManager> options, IOwinContext context)
{
var roleStore = new RoleStore<IdentityRole>(context.Get<ApplicationDbContext>());
return new ApplicationRoleManager(roleStore);
}
}
Register the ApplicationRoleManager in the Startup.Auth.cs file.
public void ConfigureAuth(IAppBuilder app)
{
// Configure the db context, user manager and signin manager to use a single instance per request
app.CreatePerOwinContext(ApplicationDbContext.Create);
app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);
app.CreatePerOwinContext<ApplicationSignInManager>(ApplicationSignInManager.Create);
app.CreatePerOwinContext<ApplicationRoleManager>(ApplicationRoleManager.Create);
Get the ApplicationRoleManager service in the code behind of your customer add/remove roles page.
protected void Button1_Click(object sender, EventArgs e)
{
ApplicationRoleManager roleManager = Context.GetOwinContext().Get<ApplicationRoleManager>();
roleManager.Create(new Microsoft.AspNet.Identity.EntityFramework.IdentityRole("Admin"));
}
Again, the RoleManager just works with the AspNetRoles table. Typically, there are only a few roles in any application, Admin, User, SuperUser, which is a one time script. Use Claims if you need many ways to describe a user.