C
C#8mo ago
gio735

✅ AutoValidateForgeryToken with fetch API

Hello, how can I pass the forgery token to the fetch API? I have tried putting it into the header as X-CSRF-TOKEN which seemingly creates token cookie, but it still can't reach specific Action
2 Replies
Angius
Angius8mo ago
How exactly are yu doing that?
gio735
gio735OP8mo ago
Sorry, I couldn't see the message. I just added it to the fetch() headers and as value gave '@Html.AntiForgeryToken()'. made it work by adding @Html.AntiForgeryToken() as a element and setting it's value as RequestVerificationToken header

Did you find this page helpful?