با سلام
در حالت GET مشکلی در اتصال به Web API وجود نداره اما در حالت Post ارور 400 میگیرم
@page
@using DevExtremeAspNetCoreApp1.Models
@Html.AntiForgeryToken()
$.ajax({
type: "POST",
url: 'api/editoropen',
data: {'guid':'wr'}
contentType: "application/json",
headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() },
success: function (data) {
alert('post successs');
},done:function (response) {
alert('ok');
},
dataType: 'json',
});
در Program.cs هم این کد ها رو زدم اما جوابی نگرفتم
builder.Services
.AddRazorPages().AddRazorPagesOptions(o =>
{
o.Conventions.ConfigureFilter(new IgnoreAntiforgeryTokenAttribute());
});
builder.Services.AddAntiforgery(o => o.HeaderName = "XSRF-TOKEN");