0
처리 중이며 같은 페이지에 등록하십시오. 등록 버튼을 클릭하면 다른 컨트롤러에서 처리되지만 내 URL은 원하지 않습니다.URL 재 작성 중 MVC4
예 : 모델 내 URL이 아직 변경하지 유효하지 않은 경우 내가 게시 할 때 1853/계정/RegisterLogin
내가 원하는 : 로컬 호스트 : 내가
HTTP를 요청합니다.
// GET: /Account/RegisterLogin [AllowAnonymous] public ActionResult RegisterLogin(string returnUrl) { ViewBag.ReturnUrl = returnUrl; ViewData["RegisterModel"] = new RegisterModel(); ViewData["LoginModel"] = new LoginModel(); return View(); } // // POST: /Account/Register [HttpPost] [AllowAnonymous] [ValidateAntiForgeryToken] public ActionResult Register(RegisterModel model) { if (ModelState.IsValid) { // Attempt to register the user try { WebSecurity.CreateUserAndAccount(model.UserName, model.Password, new { Gender = model.Gender, FirstName = model.FirstName, LastName = model.LastName, BirthDate = model.BirthDate, Email = model.Email }, false); WebSecurity.Login(model.UserName, model.Password); return RedirectToAction("Index", "Home"); } catch (MembershipCreateUserException e) { ModelState.AddModelError("", ErrorCodeToString(e.StatusCode)); } } // If we got this far, something failed, redisplay form ViewData["RegisterModel"] = model; ViewData["LoginModel"] = new LoginModel(); return View("RegisterLogin"); }
도움을 주셔서 감사합니다.