Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)
v11-v13 (latest)
Bug summary
We've noticed lately that there's some kind of issue with the backoffice anti-forgery token in some scenarios like app pool recycles and app pool switches causing the backoffice to not work and the server to return HTTP Status: 417 The anti-forgery token could not be decrypted.
This happens for us during deployments and has surfaced because customers have worked on a page that was loaded before our deployment. Then, due to the issue, they could not save their work. The only error indication is the X in the save button (no notification) so sometimes editors think that they have saved.
For the record: We do store the key ring on disk (using AddDataProtection()) and the issue does not affect anti-forgery tokens for the front end at all, only the backoffice. This also works for the Auth-cookie so we do not have to log in again in any of the scenarios.
On v12-v13 we consistently get "HTTP Status: 417 The anti-forgery token could not be decrypted" after app pool recycle on the production machines configured with default App Pool settings.
Specifics
The symptoms indicate that there is something special about how the key ring for the backoffice anti-forgery token is handled, almost as if it does not use the storage configured by ´AddDataProtection()` but creates something that seems to be dependent on the App Pool / App Pool Identity.
The anti forgery token on the front end works in all scenarios below, for both app pool recycle and app pool switches. I've also tested a vanilla MVC site with a form+anti forgery token without being able to reproduce the problem, this indicates that the backoffice token is handled in a different way causing the issue.
There are two types of actions that we've managed to find that would trigger this issue:
- App Pool recycle in certain scenarios, not all the time a recyle would invalidate the backoffice anti forgery token.
- App Pool switch, that is having two identical App Pools and switching the Websites App Pool between when the token was created and when the HTTP Post request is sent. This forum thread seems to be talking about something similar that happens with Azure Slot Swap.
Also, to be clear this does not happen:
- When running via Kesterl (dotnet run)
- When running via IIS Express from Visual Studio
We've tested on some of our production environments to identify if there were some changes in the CMS that might give us insights. This is the results:
| Machine |
Recycle |
App Pool Switch |
Umb-version |
Runtime |
App-Pool Identity |
| Windows Server 2019 #1 |
Works |
|
9.3.1 |
6.0.4 |
ApplicationPoolIdentity |
| Windows Server 2022 #1 |
Works |
|
10.3.2 |
6.0.10 |
ApplicationPoolIdentity |
| Windows Server 2022 #2 |
Works |
Error |
11.2.1 |
7.0.11 |
ApplicationPoolIdentity |
| Windows Server 2019 #2 |
Works |
|
11.2.2 |
7.0.14 |
ApplicationPoolIdentity |
| Windows 2019 #1 |
Works |
Error |
11.3.1 |
7.0.5 |
ApplicationPoolIdentity |
| Windows 2019 #1 |
Works |
|
12.0.1 |
7.0.5 |
ApplicationPoolIdentity |
| Windows Server 2022 #2 |
Error |
|
12.3.5 |
7.0.11 |
ApplicationPoolIdentity |
| Windows Server 2022 #2 |
Error |
|
12.3.5 |
7.0.11 |
ApplicationPoolIdentity |
| Windows Server 2022 #2 |
Error |
|
13.11.1 |
8.0.4 |
ApplicationPoolIdentity |
| Windows Server 2019 #2 |
Error |
|
13.2.2 |
8.0.0 |
ApplicationPoolIdentity |
Noticing that recycle worked in our tests up until 12.3.5 which might indicate that changes introduced to facilitate the content delivery API impacted this?
The "app pool switch" seems to have been an issue at least back to v 11.2.1.
Here is a screen share demonstrating the issue:

- First triggering the issue in the backoffice
- Demonstrating that the front end validates the anti forgery token
- Demonstrating that the front end anti forgery token works after the recyle, indicating that the issue is isolated to the backoffice token.
Steps to reproduce
I've created a zip for the project that I use for testing: https://www.dropbox.com/scl/fi/bd6wcnm3v19v6f6js4b1v/share-Umb-417-issue-MyProject.zip?rlkey=u1e2ezbzgqsmar30tow1vhx5f&dl=0
Here are the basic steps:
1. Create a new Umbraco website
dotnet new install Umbraco.Templates::13.2.2 --force && dotnet new sln --name "MySolution" && dotnet new umbraco --force -n "MyProject" --friendly-name "Administrator" --email "admin@example.com" --password "1234567890" --development-database-type SQLite && dotnet sln add "MyProject" && dotnet add "MyProject" package clean && dotnet run --project "MyProject"
2. Build a standard "MVC" form using a surface controller
This is to test the difference between the front-end anti-forgery token and the one used in the backoffice.
3. Publish the project
In the same folder as the .csproj, publish the project
4. Setup IIS
In IIS:
- Create two identical App Pools (e.g. test-pool1 and test-pool2).
- Create a website and point the publish folder (bin/release/net8.0/publish) of the project, use App Pool "test-pool1".
(Notice: In some scenarios, the recycle error is triggered when running the App Pool as ApplicationPoolIdentity and sometimes we've had to change the App Pool identity to a local user to trigger the problem).
5.1. Replicate "App Pool Recycle error"
- Run the website and login to the backoffice, open a page and press "save and publish", notice that this works and returns a HTTP status of 200.
- Keep the browser open, recycle the app pool
- Without refreshing the browser, press "Save and publish" - notice the 417 error.
5.2. Replicate "App Pool Switch error"
- Run the website and login to the backoffice, open a page and press "save and publish", notice that this works and returns a HTTP status of 200.
- Keep the browser open, in IIS: Open the website properties and switch App Pool from "test-pool1" to "test-pool2".
- Without refreshing the browser, press "Save and publish" - notice the 417 error.
6 Front end
Perform step 5.1 and 5.2 with the form on the front-end to notice that the error is not present here.
Expected result / actual result
The backoffice anti-forgery token should be decrypted even after app pool recycle or app pool switch, without having to reload the backoffice page.
Edit 2026-03-19:
I just want to make this thread a little more "sense". A lot of people are posting screenshots about errors and issues that might not be related to the problem that this issue is targeting. This takes away the focus from the reported issue.
Here is a checklist to ensure that you are hitting the same issue:
- Have you configured the
AddDataProtection() call in your startup code? (see example below)
- Does this problem happen ONLY for the anti forgery token? (login cookies are out of scope of this issue and should be solved by
AddDataProtection())
- Do you see the error
HTTP Status: 417 The anti-forgery token could not be decrypted in the browser console?
- Is the problem solved by applying the
PatchedBackofficeAntiforgery?
If you answer is No to any of the questions above, your issue is NOT the same and you should create a new issue.
If your answer is Yes to all of the above, please provide screenshots and log entries and share your Umbraco version.
Setup data protection-example:
builder.Services.AddDataProtection()
// This helps survive a restart: a same app will find back its keys. Just ensure to create the folder.
.PersistKeysToFileSystem(new DirectoryInfo(Path.Combine(builder.Environment.ContentRootPath,"..\\Resources\\DataProtection\\")))
Note! It seems like a lot of people are reporting errors like "The Key xxx was not in the key ring" or "Error unprotecting the session cookie". These errors indicate that there is something wrong with your data protection settings - it's not the same error. Read more about data protection here.
Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)
v11-v13 (latest)
Bug summary
We've noticed lately that there's some kind of issue with the backoffice anti-forgery token in some scenarios like app pool recycles and app pool switches causing the backoffice to not work and the server to return
HTTP Status: 417 The anti-forgery token could not be decrypted.This happens for us during deployments and has surfaced because customers have worked on a page that was loaded before our deployment. Then, due to the issue, they could not save their work. The only error indication is the
Xin the save button (no notification) so sometimes editors think that they have saved.For the record: We do store the key ring on disk (using
AddDataProtection()) and the issue does not affect anti-forgery tokens for the front end at all, only the backoffice. This also works for the Auth-cookie so we do not have to log in again in any of the scenarios.On v12-v13 we consistently get "HTTP Status: 417 The anti-forgery token could not be decrypted" after app pool recycle on the production machines configured with default App Pool settings.
Specifics
The symptoms indicate that there is something special about how the key ring for the backoffice anti-forgery token is handled, almost as if it does not use the storage configured by ´AddDataProtection()` but creates something that seems to be dependent on the App Pool / App Pool Identity.
The anti forgery token on the front end works in all scenarios below, for both app pool recycle and app pool switches. I've also tested a vanilla MVC site with a form+anti forgery token without being able to reproduce the problem, this indicates that the backoffice token is handled in a different way causing the issue.
There are two types of actions that we've managed to find that would trigger this issue:
Also, to be clear this does not happen:
We've tested on some of our production environments to identify if there were some changes in the CMS that might give us insights. This is the results:
Noticing that recycle worked in our tests up until 12.3.5 which might indicate that changes introduced to facilitate the content delivery API impacted this?
The "app pool switch" seems to have been an issue at least back to v 11.2.1.
Here is a screen share demonstrating the issue:
Steps to reproduce
I've created a zip for the project that I use for testing: https://www.dropbox.com/scl/fi/bd6wcnm3v19v6f6js4b1v/share-Umb-417-issue-MyProject.zip?rlkey=u1e2ezbzgqsmar30tow1vhx5f&dl=0
Here are the basic steps:
1. Create a new Umbraco website
2. Build a standard "MVC" form using a surface controller
This is to test the difference between the front-end anti-forgery token and the one used in the backoffice.
3. Publish the project
In the same folder as the
.csproj, publish the project4. Setup IIS
In IIS:
(Notice: In some scenarios, the recycle error is triggered when running the App Pool as
ApplicationPoolIdentityand sometimes we've had to change the App Pool identity to a local user to trigger the problem).5.1. Replicate "App Pool Recycle error"
5.2. Replicate "App Pool Switch error"
6 Front end
Perform step 5.1 and 5.2 with the form on the front-end to notice that the error is not present here.
Expected result / actual result
The backoffice anti-forgery token should be decrypted even after app pool recycle or app pool switch, without having to reload the backoffice page.
Edit 2026-03-19:
I just want to make this thread a little more "sense". A lot of people are posting screenshots about errors and issues that might not be related to the problem that this issue is targeting. This takes away the focus from the reported issue.
Here is a checklist to ensure that you are hitting the same issue:
AddDataProtection()call in your startup code? (see example below)AddDataProtection())HTTP Status: 417 The anti-forgery token could not be decryptedin the browser console?PatchedBackofficeAntiforgery?If you answer is No to any of the questions above, your issue is NOT the same and you should create a new issue.
If your answer is Yes to all of the above, please provide screenshots and log entries and share your Umbraco version.
Setup data protection-example:
Note! It seems like a lot of people are reporting errors like "The Key xxx was not in the key ring" or "Error unprotecting the session cookie". These errors indicate that there is something wrong with your data protection settings - it's not the same error. Read more about data protection here.