Asp.net MVC.RequestVerificationToken“不存在。

时间:2013-07-22 20:40:55

标签: asp.net asp.net-mvc asp.net-mvc-3 asp.net-mvc-4

我的控制器如下所示:

    [ValidateAntiForgeryToken]
    [HttpGet]
    public ActionResult LogIn()
    {
        return View();
    }

我的观点如下所示:

@model Fancy.Management.Model.Home.LogInModel
<html>
<head>
<title>Giriş</title>
</head>
<body>
@using (Html.BeginForm())
{ 
    <table>
        <tr>
            <td>Kullanıcı Adı:</td>
            <td>@Html.TextBoxFor(m => m.UserName)</td>
        </tr>
        <tr>
            <td>Şifre:</td>
            <td>@Html.PasswordFor(m => m.Password)</td>
        </tr>
        <tr>
            <td></td>
            <td>
                @Html.AntiForgeryToken()
                <input type="submit" value="Giriş" /></td>
        </tr>
    </table>
}
</body>
</html>

Everythings看起来不错,但我得到了例外:所需的防伪cookie“__RequestVerificationToken”不存在。

你有什么想法吗?

1 个答案:

答案 0 :(得分:-1)

有些移动设备没有执行POST,相反,GET将被执行而不会提交令牌,并且将抛出exeption ..