ASP.NET Authentication - Identity 2 RRS feed

  • Question

  • User-698989805 posted

    Hello Friends!! Currently I am working with ASP.NET authentication - identity 2 for creating role and membership management. It is a basic problem what I faced given below specifically for creating roles:

    Click Event: CreateRole.cs

      protected void Button1_Click(object sender, EventArgs e)
                var RoleManager = new RoleManager<IdentityRole>(new RoleStore<IdentityRole>(new ApplicationDbContext())); //Database connection - LocalDB

                IdentityRole role = new IdentityRole();

                role.Name = TextBox1.Text; //User input for role creation
                RoleManager.Create(role); //Create role

    But the problem is in the following code. It throws an exception:

    Exception: RoleManager.cs

     class RoleManager<T>
            private RoleStore<IdentityRole> roleStore;

            public RoleManager(RoleStore<IdentityRole> roleStore)
                // TODO: Complete member initialization
                this.roleStore = roleStore;

            internal void Create(IdentityRole role)
                throw new NotImplementedException(); //Throw exception while running the code
    Is there anything that I missed?? I would like to have some ideas in this regard. Thanks.

    Thursday, December 11, 2014 1:07 PM


All replies