Skip to content

Instantly share code, notes, and snippets.

@awright18
Created September 16, 2021 19:08
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 awright18/afcb06347fd9b1b1d8d0e651592a5e9b to your computer and use it in GitHub Desktop.
Save awright18/afcb06347fd9b1b1d8d0e651592a5e9b to your computer and use it in GitHub Desktop.
Razor Pages Ignore Antiforgery Token
using System;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace RazorPagesDemo.Pages
{
[IgnoreAntiforgeryToken] //this will allow post without Antiforgery tokens. Good for Ajax style requests
public class Clicked : PageModel
{
public void OnGet()
{
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment