0

How to add an anti forgery token to an 'A' link in Net6 unobtrusive ajax?

I have an a link like:

<a class="btn btn-warning btn-sm"
   data-ajax="true"
   data-ajax-begin="beginClearWCGWCs"
   data-ajax-update="#WCEditor"
   data-ajax-url="/Prefs/ClearWCGWGs/@ViewData["ActiveWCGID"]"
   data-ajax-method="get"
   data-ajax-token="@Html.AntiForgeryToken()"
   style="margin-bottom:10px;"
   title="Delete ALL">
   Delete All
 </a>

This links works except for the AntiForgeryToken.

How do I add an antiforgery token to this 'A' link?

Qing Guo
  • 6,041
  • 1
  • 2
  • 10
Mattman85208
  • 1,858
  • 2
  • 29
  • 51
  • 1
    Have a look at [this answer](https://stackoverflow.com/questions/8677933/using-the-mvc3-antiforgerytoken-with-links). – Qing Guo Dec 22 '22 at 02:03

0 Answers0