NHibernateを使用しているMVC3アプリケーションがあります。私は自分のメンバーシップと役割の提供者を作りました。彼らは大丈夫です。私はログインに問題があります(おそらくASP.NETセキュリティの経験がないためです)。私は誰かが私を助けることができるかと思います。ここでMVC3アプリにログインすると、私が誰であるかがわかりません
は私のコントローラは、私が試してみて、私は、ログインページに転送されます編集リンクをクリックしたときに、私は、だから、Web.configファイル
<authentication mode="Forms">
<forms loginUrl="~/User/Login" timeout="2880" cookieless="AutoDetect" />
</authentication>
にログインURLを設定している
[Authorize(Roles="Admin")]
public ActionResult Edit(int? id)
{
...
です。今のところよくやっている。
[HttpPost]
public ActionResult Login(LogOnModel model, string returnUrl)
{
if (ModelState.IsValid)
{
if (_membershipProvider.ValidateUser(model.UserName, model.Password))
{
FormsAuthentication.Authenticate(model.UserName, model.Password);
FormsAuthentication.RedirectFromLoginPage(model.UserName, false);
}
else
{
ModelState.AddModelError("", "The user name or password provided is incorrect.");
}
}
return View(model);
}
私が来たページに転送されますが、編集リンクを再度クリックすると、ログインページに戻ります。セッションや何かにユーザーを格納するようにASP.NETを設定すると、どのようにして私を覚えていますか?