Antiforgery token issue resolved but weird after effect on project
<p>I have 2 web application projects, both housed in TFS source control. The first project causes no issue with AntiForgery token.</p>

<p>This was the error </p>

<p>An exception of type 'System.InvalidOperationException' occurred in System.Web.WebPages.dll but was not handled in user code</p>

<p>Additional information: A claim of type '<a href="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier" rel="nofollow">http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier</a>' or '<a href="http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider" rel="nofollow">http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider</a>' was not present on the provided ClaimsIdentity. To enable anti-forgery token support with claims-based authentication, please verify that the configured claims provider is providing both of these claims on the ClaimsIdentity instances it generates. If the configured claims provider instead uses a different claim type as a unique identifier, it can be configured by setting the static property AntiForgeryConfig.UniqueClaimTypeIdentifier.</p>

<p>and the found solution was to add</p>

<pre><code>AntiForgeryConfig.UniqueClaimTypeIdentifier = ClaimsIdentity.DefaultNameClaimType;
</code></pre>

<p>that to the Global.asax.cs file of the project that kept throwing that error, so I did and it fixed the issue.</p>

<p>However...Now this is where the weird part comes in...When I run the "fixed" application I am logged in as the user from my other web application.</p>

<p>So I decided to run the other application and noticed I was still logged in, so I logged out and stopped debugging. Then went into the "fixed" project and commented out the </p>

<pre><code>AntiForgeryConfig.UniqueClaimTypeIdentifier = ClaimsIdentity.DefaultNameClaimType;
</code></pre>

<p>and the project ran properly.</p>

<p>So apparently if I don't log out from the other application then this error gets thrown.</p>

<p>I have no idea what this is all about or even why this is happening, any idea's?</p>