Anti forgery system on ASP.Net MVC

后端 未结 2 1570
忘掉有多难
忘掉有多难 2021-02-08 06:22

When I\'m putting following code:

 @using (Html.BeginForm(\"LogOff\", \"Account\", FormMethod.Post, new { id = \"logoutForm\" }))
    {
        @Html.AntiForgery         


        
2条回答
  •  北海茫月
    2021-02-08 07:02

    It's telling you that it won't work because despite being logged in, Membership.GetUser().UserName is not providing a name that can be used for hashing.

    So your real problem is, "How come my logged in user doesn't have a username?"

提交回复
热议问题