0

I am writing an ASP.NET Core 6 MVC app, and I am using X.PagedList to do paging.

In my table I set this for Paging

@Html.PagedListPager((IPagedList)Model.SearchResultViewPaging, page => 
         Url.Action("ResultPaging", "Participant", new { page = page }))
  

The method in the controller is decorated with a [ValidateAntiForgeryToken] annotation. I have this as a warning of Veracode.

In Javascript, this is the call I use to send

headers: {
            "RequestVerificationToken":
            $('input:hidden[name="__RequestVerificationToken"]').val()
         },

How can I send this as a header?

Thanks

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Diego
  • 2,238
  • 4
  • 31
  • 68
  • Could you tell me what you want ? you want fix the warning or implement Antiforgery in webapi ? – Jason Pan Feb 16 '23 at 07:40
  • I want to implement ValidateAntiForgeryToken in the controller method, so I need to send a header in the pagination... I think it is the only way... thanks – Diego Feb 16 '23 at 15:11
  • Since X.PagedList is 3rd package, pls wait, I will investigate the issue next week. – Jason Pan Feb 17 '23 at 09:56
  • 1
    Hi Diego, [does the link useful to you](https://stackoverflow.com/a/42652024/7687666) ? – Jason Pan Feb 21 '23 at 09:34

0 Answers0