Question: I am trying to avoid "AntiForgery" checking as it always fails when hosted from the 3rd party server. I am using ASP.NET Core 2.0 MVC application.

I added this option in the `ConfigureServices` function:

```
services
    .AddMvc()
    .AddRazorPagesOptions( options =>
    {
        options.Conventions.AuthorizeFolder("/Account/Manage");
        options.Conventions.AuthorizePage("/Account/Logout");
        options.Conventions.ConfigureFilter(new IgnoreAntiforgeryTokenAttribute());
    } );

```

But still I am getting this exception.

> 
> System.InvalidOperationException: The antiforgery token could not be decrypted.  
> 
>  System.Security.Cryptography.CryptographicException: The key {6fb328e7-4808-4b5d-b7dc-870d126e5ca4} was not found in the key ring.
> 
> 
> 

Am I missing anything ?

Answer: 
Been looking around for how to disable the cookie, setting the Order does not seem to help for me, and trying to set it to all pages via below also did not work for me.

```
options.Conventions.ConfigureFilter(new IgnoreAntiforgeryTokenAttribute());

```

I eventually found article below which helps per deleting the cookie locally, at least. Add the line below in the Startup.cs
[Disable .AspNetCore.Antiforgery Cookie](https://stackoverflow.com/questions/50411402/disable-aspnetcore-antiforgery-cookie)

```
services.AddAntiforgery(options => { options.Cookie.Expiration = TimeSpan.Zero;});

```
In case anyone else struggles with this in NET 6;

```
services.AddAntiforgery(options => { options.SuppressXFrameOptionsHeader = true; });

```