ASP.NET MVC 4 앱에서 로그인 양식을 설정하려고합니다. 다음과 같이 현재, 내보기를 구성한 :ASP.NET MVC 4의 GET 및 POST 경로 라우팅
RouteConfig.cs을
routes.MapRoute(
"DesktopLogin",
"{controller}/account/login",
new { controller = "My", action = "Login" }
);
MyController.cs
public ActionResult Login()
{
return View("~/Views/Account/Login.cshtml");
}
[AllowAnonymous]
[ValidateAntiForgeryToken]
public ActionResult Login(LoginModel model)
{
return View("~/Views/Account/Login.cshtml");
}
난에/계정/로그인을 방문 할 때 브라우저에서 다음과 같은 오류 메시지가 나타납니다.
The current request for action 'Login' on controller type 'MyController' is ambiguous between the following action methods:
System.Web.Mvc.ActionResult Login() on type MyApp.Web.Controllers.MyController
System.Web.Mvc.ActionResult Login(MyApp.Web.Models.LoginModel) on type MyApp.Web.Controllers.MyController
ASP.NET MVC 4에서 기본 양식을 어떻게 설정합니까? ASP.NET MVC 4에서 예제 인터넷 응용 프로그램 템플릿을 살펴 보았습니다. 그러나 라우팅이 어떻게 연결되는지 파악할 수 없습니다. 도와 주셔서 정말 감사합니다.
맞춤 경로를 사용하여 달성하려는 목표는 무엇입니까? 유청은 기본 경로 ({controller}/{action}/{id})를 그대로 두지 않았습니까? 기본 경로가 정상적으로 작동해야합니다. –
@KevinJunghans - 당신이 알아 차리지 못했을 경우, 그의 컨트롤러 이름은 그의 URL과 다릅니다. –
'[ViewSettings (Minify = true)] 란 무엇입니까? 이 속성에 대한 참조를 찾을 수 없습니다. 그것은 당신이 창조 한 것입니까? –