Reputation: 23546
I have looked everywhere but could not find code on how to create a custom AntiforgeryTokenAttribute using Asp.net Core. I've found examples based on older versions of Asp.net but not Core. I want to add some logic for when the token is validated to only validate based on some business rules. I've tried creating a new attribute inheriting AntiforgeryTokenAttribute but there doesn't seem to be any override that lets me control when to validate and when to ignore a forgery token.
Upvotes: 1
Views: 2252
Reputation: 76
Maybe this can help you, it creates a custom attribute like antiforgerytoken https://stackoverflow.com/a/59550210/7071238
Upvotes: 4