Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The required anti-forgery cookie "__RequestVerificationToken" is not present.

Tags:

asp.net-mvc

The required anti-forgery cookie "__RequestVerificationToken" is not present.

I have added in cshtml and in Controller also

 using (Html.BeginForm())
 {
   @Html.AntiForgeryToken()

  //some code

  }

     [HttpGet]
    [ValidateAntiForgeryToken]
    public ActionResult Index()
    {
        using (var db = new SampleEntities())
        {
            return View(db.Rfps.ToList());
        }



    }
like image 406
user3233312 Avatar asked Nov 05 '14 14:11

user3233312


People also ask

What is __ Requestverificationtoken cookie?

__RequestVerificationToken Session www.ese-hormones.org Strictly Necessary This is an anti-forgery cookie set by web applications built using ASP.NET MVC technologies. It is designed to stop unauthorized posting of content to the website, known as Cross-Site Request Forgery.

How do you fix Anti-forgery cookies?

Try quick fixes The common “possible solutions” to anti-forgery token/cookie related issues are disabling output caching and enabling heuristic checks.

What is Requestverificationtoken?

To help prevent CSRF attacks, ASP.NET MVC uses anti-forgery tokens, also called request verification tokens. The client requests an HTML page that contains a form. The server includes two tokens in the response. One token is sent as a cookie. The other is placed in a hidden form field.

What is HTML AntiForgeryToken () in MVC?

AntiForgeryToken()Generates a hidden form field (anti-forgery token) that is validated when the form is submitted. C# Copy. public System.Web.Mvc.


1 Answers

In my case, I had this in my web.config:

<httpCookies requireSSL="true" />

But my project was set to not use SSL. Commenting out that line or setting up the project to always use SSL solved it.

like image 170
Justin Skiles Avatar answered Oct 27 '22 01:10

Justin Skiles