MVC 4 - LogOff controller action giving 404 not found

前端 未结 3 2094
梦如初夏
梦如初夏 2021-02-12 22:46

I\'m just wrapping up a college project, I\'m not sure if I\'ve been staring at my computer for too long and am missing something obvious, but when I try to log a user out, I\'m

3条回答
  •  天命终不由人
    2021-02-12 23:11

    Since logout modifies server state, I wouldnt remove [HttpPost] and [ValidateAntiForgeryToken] Instead I will replace the link (anchor tag) with the following

    @using (Html.BeginForm("Log Out", "Account", FormMethod.Post,
     new { id = "logoutForm" }))
    {
    
        @Html.AntiForgeryToken()
        Log Out
    
    }
    

提交回复
热议问题