Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Empty or invalid anti forgery header token #1593


User avatar
0
maddey234 created

Hello,

I keep getting this error when I try to upload a document when I upgraded to version 1.12.

(Empty or invalid anti forgery header token.)

What do I need to add to my code to stop getting this error.

Thanks


1 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    This is related to new automatic CSRF protection system.

    Probably this is similar to: <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/issues/309">https://github.com/aspnetzero/aspnet-zero/issues/309</a>

    Add [DisableAbpAntiForgeryTokenValidation] attribute to file upload actions.

    Also, I suggest to see <a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/XSRF-CSRF-Protection">http://www.aspnetboilerplate.com/Pages/ ... Protection</a> to understand the CSRF protection system and adapt your codebase.