【发布时间】:2014-03-18 12:51:14
【问题描述】:
大家好,我有一个设置了 Authorize 属性的 MVC 操作。对于这些操作中的每一个,都有一个仅对该操作有效的密码/安全密码。
public ActionResult Action_1()// generic pin 1
{
Return RedirectToAction("PinCheck", new { returnUrl = "Action_1" });
...
}
[Authorize]
public ActionResult Action_2()// generic pin 2
{
...
}
[Authorize]
public ActionResult PinCheck(string returnUrl)// generic pin 1
{
// request three characters of the pin in random.
...
}
[Authorize]
[HttpPost]
public ActionResult PinCheck(string a, string b, string c, string returnUrl)// generic pin 1
{
// check the three chars.
...
// How do I store pin check for the controller was a success and don't ask the user unless he closes browser or logout
}
我的行动计划是检查管理员为特定用户存储在数据库中的特定操作的 pin。到目前为止,我已经实现了检查PinCheck() 例程,但我面临的问题是用户每次请求特定操作时都必须输入密码。我通过在PinChecksuccess 上保存一个加密的 cookie 来解决这个问题。但是有没有办法修改Authorize 属性和身份验证cookie 本身来实现我在做什么?
【问题讨论】:
标签: asp.net-mvc cookies asp.net-mvc-5