Category - Unobtrusive
29 Jan 2021 29 Jan 2021 0 Comments  1658 Views
Here Mudassar Ahmed Khan has explained with an example, how to use AntiForgeryToken with jQuery Unobtrusive AJAX in ASP.Net Core Razor Pages.

The jQuery Unobtrusive AJAX library does not support adding headers to the request and hence it is not possible to send AntiForgeryToken.

Thus, the possible way is to make use of normal jQuery AJAX function and then send the AntiForgeryToken by adding it to the request headers.
29 Jan 2021 29 Jan 2021 0 Comments  3409 Views
Here Mudassar Ahmed Khan has explained with an example, how to use jQuery Unobtrusive AJAX in ASP.Net Core Razor Pages.

The POST method of the Razor Page will be called using jQuery AJAX Unobtrusive library and JSON from HTML in ASP.Net Core.