デコレータなしとデコレータ付きControllerの2つのアクションがあります。LogonLogOn[HttpPost]
コード:
public ActionResult LogOn()
{
return View();
}
[HttpPost]
public ActionResult LogOn(string username, string password,
bool? rememberMe, string returnUrl)
{
AccountService client = new AccountService();
if (client.IsUserAllowedIn(username, password))
FormsAuthentication.SetAuthCookie(username, rememberMe ?? false);
return Redirect(returnUrl);
}
私が直面している問題は、デコレータを使用してメソッドにアクセスしようとしても、[Authorize]デコレータを使用したアクションにASP.NET MVCリダイレクトされないことです。LogOn[HttpPost]
LogOnテストの目的で、 usingというフォームを作成しましたが、Post機能しました。したがって、問題はデコレータの使用方法にあると思います。
私のweb.config:
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>
私が間違っていることについて何か考えはありますか?