On a customer site, we have implemented multiple Sitecore 9 Forms on the same page. One of these forms is used to sign-in to the website.
When customers submit the sign-in form, the other forms seem to be triggered as well – the next form will throw an error like this: Anti forgery token is meant for user “” but the current user is “username”
Anti forgery token is meant for user “” but the current user is “username”
This was a common problem in Sitecore when having multiple MVC forms on a page at the same time. The workaround for MVC forms is to add the ValidateRenderingTokenValidateRenderingToken
attribute to all the POST methods before the ValidateAntiForgeryTokenValidateAntiForgeryToken
attribute. The ValidateRenderingTokenValidateRenderingToken
stops the execution of any method that wasn’t triggered by the submitted form.
How to use the AntiForgeryToken with a custom log-in form?
We need to do something similar for our Sitecore 9 Forms, but we don’t have an MVC Action method – we’re working with Form Submit Actions instead.
Has anyone faced this issue before? Do you have an idea how to resolve the problem?