Dot.Net Developer
In .net core you can add AutoValidateAntiforgeryTokenAttribute in Startup.cs file, So there is no need to add controller or action attribute ([ValidateAntiForgeryToken]) (dependency injection)
So add this to Startup.cs
services.AddMvc(options => options.Filters.Add(new AutoValidateAntiforgeryTokenAttribute()))
and then add below to view page .cshtml
AntiForgeryToken()
and in ajax call something like this
$.ajax({
type: "POST",
url: '.Action("actionName", "ControllerName")',
beforeSend: function (request) {
request.setRequestHeader("RequestVerificationToken", $("[name='__RequestVerificationToken']").val());
},
data: data,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (result) { }.....
Click here to claim your Sponsored Listing.
Category
Contact the business
Website
Address
Naas Road
Dublin
22