❔ The correct way to make a http post call in asp.net core mvc 6 web app.
The autoAntiforgery is on in controller, the anitforgery token is injected in view, But I can not make the http call unless I open the inspector and disable cache then refresh the page. thus , it can make the call.
How to do such call properly?
14 Replies
How do you make the call?
The ajax call only can be made when inspector is on and disable cache. You refresh the page manually.
I think it would be a trick in the view cshtml file.
How do you send the token with the AJAX call?
set the token in the header
ChatGpt can not deal it also. lol
How do you get the token?
Show some code, ideally
antifogery has method getandstore token
$details
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, and what you expect the result to be. Upload code here https://paste.mod.gg/ (see $code for more information on how to paste your code)
My fault. Some AIs check the code, its no problem.
Forget it.
If you'd rather use ChatGPT than post some code, aight, that's your choice ¯\_(ツ)_/¯
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
.NET documentation
Learn to use .NET to create applications on any platform using C#, F#, and Visual Basic. Browse API reference, sample code, tutorials, and more.
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.