locked
how to change config identity in mvc ? RRS feed

  • Question

  • User1928394251 posted

    hello . i use    IdentitySample.Models  in my project .

    in my identityconfig  is under code :

    public static void InitializeIdentityForEF(ApplicationDbContext db) {
    var userManager = HttpContext.Current.GetOwinContext().GetUserManager<ApplicationUserManager>();
    var roleManager = HttpContext.Current.GetOwinContext().Get<ApplicationRoleManager>();
    const string name = "admin@example.com";
    const string password = "Admin@123456";
    const string roleName = "Admin";

    how to change name , pass in  this file ?

    Thursday, August 8, 2019 8:00 AM

Answers

  • User1520731567 posted

    Hi aabedeni056,

    I can't quite understand what your mean.

    This part of code is to set the database intializer which is run once during application start

    This seeds the database with admin user credentials and admin role.

    Create User=Admin@Admin.com with password=Admin@123456 in the Admin role

    You could change them directly on it.

    If you have any question,please post more details and more explanation.

    Best Regards.

    Yuki Tao

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, August 9, 2019 9:00 AM

All replies

  • User753101303 posted

    Hi,

    There are just C# string constants and to me you should be able to just change that as you wish. I'm not sure about this sample but my guess is that it is perhaps used as a default to create a user if none is found?

    Thursday, August 8, 2019 8:26 AM
  • User1520731567 posted

    Hi aabedeni056,

    I can't quite understand what your mean.

    This part of code is to set the database intializer which is run once during application start

    This seeds the database with admin user credentials and admin role.

    Create User=Admin@Admin.com with password=Admin@123456 in the Admin role

    You could change them directly on it.

    If you have any question,please post more details and more explanation.

    Best Regards.

    Yuki Tao

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, August 9, 2019 9:00 AM