locked
How to improve the performance for FBA users creation? RRS feed

  • Question

  • Hi All,

    I have to create >9K FBA users. I am using code below for that. I figured out the execution of web.EnsureUser(user.UserName) takes 15 seconds. This is not acceptible. Is there a way to optimize a perfomance?

    MembershipUser user = Membership.CreateUser(userAdd.LoginName, passwd, userAdd.LoginName + "@fff.com", "_Not_used_", "_Not_used_", true, out status);
    if (status == MembershipCreateStatus.Success)
    {
        user.IsApproved = true;
        SPUser newUser = web.EnsureUser(user.UserName);
        newUser.Name = userAdd.UserName;
        newUser.Update();
    ....
    
    }

     


    Oleg

    Thursday, October 11, 2012 10:18 PM

Answers

  • Got much better performance with the code below instead web.EnsureUser(user.UserName);

    string userName = cfg.FBAUserPrefix + userAdd.LoginName;
    web.SiteUsers.Add(userName, userAdd.LoginName + "@fff.com", userAdd.UserName, "Note:" + userAdd.Group);
    SPUser newUser = web.SiteUsers[userName];
    


    Oleg

    • Proposed as answer by Brandon Atkinson Tuesday, October 16, 2012 4:11 PM
    • Marked as answer by Qiao Wei Sunday, October 21, 2012 1:44 PM
    Tuesday, October 16, 2012 1:50 PM