• Register
0 votes

Problem :

I am using the Membership.create user function, then a below error is occurring:

“The required anti-forgery form field "__RequestVerificationToken" is not present”

How can I resolve above error?

7 5 2
3,870 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

If you have a [ValidateAntiForgeryToken] attribute before the action. Then you also should add a @Html.AntiForgeryToken() in the form.


In my case, I had below code in my web.config:

<httpCookies requireSSL="true" />

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


Please make sure that in your controller that you have the http attribute like:


Also add a attribute in a controller:


In your form on the view you have to write as below:


I had the Html.AntiForgeryToken(); without a @ sign while it was in the code block, it didn't give the error in Razor but did give at runtime. So make sure you look at the @ sign of @Html.Ant.. if it is missing there or not


If anyone is experiencing a error for the same reason why I experience it, then here's my solution:

If you had a Html.AntiForgeryToken();

Then change it to @Html.AntiForgeryToken()

9 7 4
38,600 points

Related questions

1 vote
1 answer 69 views
Problem : While binding the dropdown in MVC, I often face following error: There is no ViewData item of type 'IEnumerable<SelectListItem>' that has the key country. Please find below my View for your reference : @Html.DropDownList("country", (IEnumerable<SelectListItem>)ViewBag ... .countryid.ToString() }); } ViewBag.mycountrydrop = myitem8; return View(); I do not know how to resolve above error.
asked Dec 28, 2019 alecxe 7.5k points
0 votes
1 answer 19 views
Problem: to allow get requests set jsonrequestbehavior to allowget.
asked Feb 23 Ethan ross 2.7k points
0 votes
1 answer 37 views
Problem: Currently I have the table called Student in the database with some of the values and I am trying to display the values in the webgrid with the help of entityframework. I have done exactly the same kind of work before many times using the Ado.net, but ... I assign the VAR value to List also is this my correct approach? Kindly guide me in fixing my problem related to Entity Framework.
asked Jul 3, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 762 views
Problem : Facing following ASP.Net error an asynchronous module or handler completed while an asynchronous operation was still pending.
asked Nov 14, 2019 peterlaw 6.9k points
0 votes
1 answer 43 views
Problem : no type was found that matches the controller named
asked Feb 23 Shovo210 14k points
0 votes
1 answer 3 views
Problem: I'll make a submission for a response to my question. Please, I have searched the internet but have not found any useful material, and I am now having trouble continuing my studies.
asked Apr 1 rakib1 51.5k points
0 votes
0 answers 2 views
Problem: Help me to call stored procedure in mvc controller.
asked Mar 31 zayed1 35.6k points
0 votes
0 answers 6 views
Problem: what is the possible outcome of this question? two submit buttons in one form
asked Mar 7 bilal b 420 points
0 votes
1 answer 16 views
How can i apply any entity framework approach like code first and database first in the ASP.NET MVC application.
asked Sep 16, 2020 Daniel Anderson 4k points
0 votes
1 answer 15 views
I have a hash of words and respective frequencies, that I want to order by frequency. Sorted Dictionary orders by key, not value. Some resort to a custom class, but is there a cleaner way?
asked Aug 31, 2020 Sofi55 1.1k points