ASP.NET MVC 4 アプリでログイン フォームを設定しようとしています。現在、ここに示すようにビューを構成しています。
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");
}
ブラウザーで /account/login にアクセスしようとすると、次のようなエラーが表示されます。
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 のサンプル インターネット アプリ テンプレートを見てきました。手伝ってくれてどうもありがとう。