Why do we get HttpAntiForgeryException after publishing update to Azure Web app service?

0

We published an application update to the same Azure web app service and started getting errors:

Exception: System.Web.Mvc.HttpAntiForgeryException (0x80004005): The anti-forgery token could not be decrypted. If this application is hosted by a Web Farm or cluster, ensure that all machines are running the same version of ASP.NET Web Pages and that the configuration specifies explicit encryption and validation keys. AutoGenerate cannot be used in a cluster.

This happens to clients using a login page within the app. These are the response headers:

HTTP/1.1 200 OK
Cache-Control: private
Content-Length: 5585
Content-Type: text/html; charset=utf-8
Vary: Accept-Encoding
Server: Microsoft-IIS/10.0
X-AspNetMvc-Version: 5.2
X-Frame-Options: SAMEORIGIN
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Wed, 30 Jan 2019 14:23:33 GMT

The client has to either close the browser and reopen or clear the browser's cookies to fix the problem.

The web app was running 3 app service instances before and after the upgrade. ARR Affinity is on.

Why is this happening and how do I fix it?

azure
azure-web-app-service
asked on Stack Overflow Jan 30, 2019 by Andrew Jocelyn

1 Answer

0

Have a look at this answer. Since this issue has just started happening, verify that you don't have a inadvertant calls to @Html.AntiForgeryToken() between veiws.

answered on Stack Overflow Feb 22, 2019 by Ryan Hill - MSFT

User contributions licensed under CC BY-SA 3.0