CreateUser() public method

public CreateUser ( string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, MembershipCreateStatus, &status ) : MembershipUser
username string
password string
email string
passwordQuestion string
passwordAnswer string
isApproved bool
providerUserKey object
status MembershipCreateStatus,
return MembershipUser
コード例 #1
0
        //[ValidateAntiForgeryToken]
        public ActionResult Register(RegisterModel model)
        {
            if (ModelState.IsValid)
            {
                // Attempt to register the user
                var membership = new CodeFirstMembershipProvider();
                try
                {
                    MembershipCreateStatus status;
                    membership.CreateUser(model.Username, model.Password, model.Email, string.Empty, string.Empty, false, null, out status);
                    if (status == MembershipCreateStatus.Success)
                    {
                        //  EmailManager.SendConfirmationEmail(model.Username);
                        return(RedirectToAction("Confirmation", "Account"));
                    }
                }
                catch (MembershipCreateUserException e)
                {
                    ModelState.AddModelError("", ErrorCodeToString(e.StatusCode));
                }
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
コード例 #2
0
ファイル: AccountController.cs プロジェクト: punj-aab/School
        public ActionResult Register(RegisterModel model)
        {
            if (ModelState.IsValid)
            {
                // Attempt to register the user
                var membership = new CodeFirstMembershipProvider();
                try
                {
                    MembershipCreateStatus status;
                    membership.CreateUser(model.Username, model.Password, model.Email, string.Empty, string.Empty, false, null, out status);
                    if (status == MembershipCreateStatus.Success)
                        //  EmailManager.SendConfirmationEmail(model.Username);
                        return RedirectToAction("Confirmation", "Account");
                }
                catch (MembershipCreateUserException e)
                {
                    ModelState.AddModelError("", ErrorCodeToString(e.StatusCode));
                }
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }