public CreateUser ( string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, MembershipCreateStatus, &status ) : MembershipUser | ||
username | string | |
password | string | |
string | ||
passwordQuestion | string | |
passwordAnswer | string | |
isApproved | bool | |
providerUserKey | object | |
status | MembershipCreateStatus, | |
return | MembershipUser |
//[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)); }
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); }