Answer:
To avoid Cross Site Request Forgery (CSRF) in ASP.NET MVC, you need to do two things.
1. Add [ValidateAntiForgeryTocken] attribute in the Controller Action method which is executing when the form data is being submitted.
2. Add @Html.AntiForgeryTocken() element in the HTML form.
Asked In: Many Interviews |
Alert Moderator