Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException: The required antiforgery cookie ".AspNetCore.Antiforgery.9TtSrW0hzOs" is not present

Question: How do you resolve the error in .Net 5 Login: Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException: The required antiforgery cookie ".AspNetCore.Antiforgery.9TtSrW0hzOs" is not present


Please Login to see the rest of the answer

Answer:  Asp.Net Core doesn't generate anti-forgery tokens for safe HTTP methods, one way to solve this error is to include a built-in Action Filter on the Loggin Action called [AutoValidateAntiforgeryToken]. This will allow the Framework to decide when to validate an AntiforgeryToken.


Write an Article
If you log in, you will be notified when someone leaves a comment.

Other users would like to know if this solution helped you.


© 2022 - ErnesTech - Privacy