• 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

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 34 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 25 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 Raphael Pacheco 4.9k points
0 votes
1 answer 351 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
2 answers 201 views
Problem : Currently I am migrating from the Identity 1.0.0 to Identity 2.0.1. But the migrations code generated is nothing about the new IdentityUser. And It does not even add the new columns. So I tried to make the new project and also I ... current context At below line IdentityResult result = await UserManager.CreateAsync(user, model.Password); Any clue about the solution on my above problem?
asked Dec 25, 2019 alecxe 7.5k points
0 votes
1 answer 48 views
Problem : I am having my radcombo machines on aspx page and whenever I try to select any option from them then it gives me following `Server Error in '/' Application. Exception Details: System.InvalidOperationException: Operation is not valid due to the current state of the object. My Version Information: Microsoft .NET Framework Version: 2.0.50727.3634 ASP.NET Version: 2.0.50727.3634
asked Dec 2, 2019 alecxe 7.5k points