ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
include Antiforgery token for the Grid request in Razor Pages
Title:
B
I
{code}
?
I'm trying to load a grid in a Razor Pages model but I need to include an antiforgery token in my requests to the server for this to work. Is there any way to do this?
Save Changes
Cancel
Benji
asked at 22 Dec 2018
Answers
B
I
{code}
?
You can use `ParameterFunc(jsfunc)` for this (can't use `Parent(id, alias)` because the token input doesn't have an id), example: <script> function getToken() { return { __RequestVerificationToken: $('[name="__RequestVerificationToken"]').val() }; } </script> @(Html.Awe().Grid("Grid1") ... .ParameterFunc("getToken"))
Save Changes
Cancel
Omu
answered at 22 Dec 2018
Thanks that worked!
at 22 Dec 2018
Benji
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK