---
title: "What’s the most effective measure to take against a CSRF?"  
description: "What’s the most effective measure to take against a CSRF?"  
author: "Mukul Goenka"  
published: 2022-05-05  
canonical: https://answers.mindstick.com/qa/97147/what-s-the-most-effective-measure-to-take-against-a-csrf  
category: "troubleshooting"  
tags: ["troubleshooting", "network-security", "networking"]  
reading_time: 1 minute  

---

# What’s the most effective measure to take against a CSRF?

What’s the most effective [measure](https://www.mindstick.com/articles/12961/nonactin-based-biosensors-to-measure-ammonia) to take [against](https://yourviews.mindstick.com/view/81243/hong-kong-2020-movement-against-china) a [CSRF](https://www.mindstick.com/forum/34124/how-to-avoid-cross-site-request-forgery-csrf-in-asp-dot-net-mvc)?

## Answers

### Answer by Hitesh Vohra

- The most common way for preventing **Cross-site Request Forgery** is to employ a challenge token that is linked to a specific user and delivered as a hidden value in every state-changing form in the web app. The anti-CSRF token (commonly abbreviated as CSRF token) or synchronizer token functions as follows:
- The web server generates and saves a token.
- The token is set statically as a hidden field in the form, and the user submits it.\
- The token is part of the data in the POST request.
- The programme compares the token it generates and saves with the token given in the request.
- The request is legitimate if these tokens match.
- The request is invalid and denied if these tokens do not match.

\

**Read More: [Which is a more secure project: open-source or proprietary?](https://answers.mindstick.com/qa/97146/which-is-a-more-secure-project-open-source-or-proprietary)**


---

Original Source: https://answers.mindstick.com/qa/97147/what-s-the-most-effective-measure-to-take-against-a-csrf

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
