how to prevent CSRF attack in asp.net
how to prevent CSRF attack in asp.net
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Rohan GuptaPosted Jan 7, 2019, 11:48 PM
Sanwar RanwaPosted Jan 7, 2019, 11:21 PM
Rohan GuptaPosted Jan 7, 2019, 11:18 PM
Suraj KumarPosted Jan 5, 2019, 5:05 AM
You could try the following. In the Web-Form add:
ViewStateUserKey & Double Submit Cookie
Starting with Visual Studio 2012, Microsoft added built-in CSRF protection to new web forms application projects. To utilize this code, add a new ASP .NET Web Forms Application to your solution and view the Site.Master code behind page. This solution will apply CSRF protection to all content pages that inherit from the Site.Master page.
The following requirements must be met for this solution to work:
All web forms making data modifications must use the Site.Master page. All requests making data modifications must use the ViewState. The web site must be free from all Cross-Site Scripting (XSS) vulnerabilities. See how to fix Cross-Site Scripting (XSS) using Microsoft .Net Web Protection Library for details.
Rajeesh MenothPosted Jan 5, 2019, 3:54 AM
Sanwar RanwaPosted Jan 4, 2019, 11:24 PM