public ActionResult RegisterUser(RegisterUserModel model) { if (ModelState.IsValid) { try { Membership.CreateUserAndAccount(model.Account, model.Password, new { CreationDate = DateTime.Now, LastActivityDate = DateTime.Now }); ViewData["Message"] = "Account created successfully and ready to use."; } catch (System.Web.Security.MembershipCreateUserException e) { ModelState.AddModelError("RegisterUser", ErrorCodeToString(e.StatusCode)); } } ViewBag.Account = model.Account; FormToViewData(); return(View("Manage")); }