开发者

Setting a profile property in asp.net MVC while creating a user

In my application, an authorized user will Register a new customer and set their username and password, etc. The customer will not be registering them self.

I have the following code in a class file which creates the new user, and it works just fine.

   public MembershipCreateStatus CreateUser(string userName, string password, string email, string employeeID)
    {
        if (String.IsNullOrEmpty(userName)) throw new ArgumentException("Value cannot be null or empty.", "userName");
        if (String.IsNullOrEmpty(password)) throw new ArgumentException("Value开发者_运维百科 cannot be null or empty.", "password");
        if (String.IsNullOrEmpty(email)) throw new ArgumentException("Value cannot be null or empty.", "email");

        MembershipCreateStatus status;
       /// _membershipProvider.CreateUser("asdas","ds123BB", email, "asdasd", "asdasdad", true, null, out status);
        _membershipProvider.CreateUser(userName, password, email, null, null, true, null, out status);


        string answer = status.ToString();
        return status;
    }

However I would also like to set an employeeID property for the profile when creating this user.

how would I set the EmployeeID when creating a new user?? Thanks


You will need to write a custom membership provider. Here's a video and an article about how this could be accomplished.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜