---
title: "What is use of [ValidateAntiForgeryToken] in ASP.NET MVC Views"  
description: "What is use of [ValidateAntiForgeryToken] in ASP.NET MVC Views"  
author: "Sachin Singh"  
published: 2016-03-21  
updated: 2016-03-21  
canonical: https://www.mindstick.com/forum/34068/what-is-use-of-validateantiforgerytoken-in-asp-dot-net-mvc-views  
category: "asp.net mvc"  
tags: ["c#", "asp.net", "security in .net", "asp.net mvc"]  
reading_time: 1 minute  

---

# What is use of [ValidateAntiForgeryToken] in ASP.NET MVC Views

Hi All,\
I want to know what is benefit to using **[ValidateAntiForgeryToken]** in above of our [controller](https://www.mindstick.com/blog/273/passing-values-from-controller-to-view-in-asp-dot-net-mvc) view . Here i want to give a [snapshot](https://www.mindstick.com/interview/1903/what-is-a-snapshot) of [login](https://www.mindstick.com/articles/12852/styles-login-form-in-android) [partial view](https://www.mindstick.com/articles/1132/auto-refresh-partial-view-in-asp-dot-net-mvc):\
![What is use of [ValidateAntiForgeryToken] in ASP.NET MVC Views](https://www.mindstick.com/mindstickforums/4701d152-3bb7-45de-a941-6ba69bb4d79c/images/9abe29e3-d1cd-482b-ac9a-fa4b5a528f02.png)\
\
Please can anyone give me a solution.\
Thank you.

## Replies

### Reply by Anupam Mishra

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](https://yourviews.mindstick.com/view/84701/layoffs-in-google-india-2023-view).

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

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.

\

```
 [ValidateAntiForgeryToken]public ViewResult Action_Method(){}
```

\


---

Original Source: https://www.mindstick.com/forum/34068/what-is-use-of-validateantiforgerytoken-in-asp-dot-net-mvc-views

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
