Home > DeveloperSection > Forums > What is use of [ValidateAntiForgeryToken] in ASP.NET MVC Views
Sachin Singh
Sachin Singh

Total Post:26

Posted on    March-21-2016 12:02 AM

 ASP.NET MVC C#  ASP.Net  Security in .Net  ASP.NET MVC 

 1 Reply(s)
 919  View(s)
Rate this:
Hi All,

I want to know what is benefit to using [ValidateAntiForgeryToken] in above of our controller view . Here i want to give a snapshot of login partial view:

Please can anyone give me a solution.

Thank you.

Anupam Mishra

Total Post:135

Posted on    March-21-2016 12:28 AM

Hi Sachin,


I have generally use  AntiForgeryToken  for prevents external get requests. So no one can access outside.

 Suppose, we are having AntiForgeryToken in our Html.BeginForm in View.


@using (Html.BeginForm())

When we submit form, we sends data to your Controller method. If method has ValidateAntiForgeryToken attribute, it validates if data we are sending has our  ForgeryToken.ForgeryToken is generated once per session.

public ViewResult Action_Method()

Modified On Mar-21-2016 12:29:09 AM

Don't want to miss updates? Please click the below button!

Follow MindStick