Skip to content

Instantly share code, notes, and snippets.

@hd9
Last active February 7, 2020 19:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hd9/90ba16a6a5f132187b515cbcbcec72ea to your computer and use it in GitHub Desktop.
Save hd9/90ba16a6a5f132187b515cbcbcec72ea to your computer and use it in GitHub Desktop.
How to validate incoming requests on ASP.NET endpoints using custom ActionFilters
// **********************************************
// Fore more information, visit:
// https://blog.hildenco.com/2017/12/aspnet-allowing-anonymous-requests-on.html
// **********************************************
[HttpPost]
[ValidateAntiForgeryToken]
[RequirePermission("Update")]
public async Task<JsonResult> SomeOperation(string id)
{
// your code here
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment