…do not try this at home…well do not try this anywhere :-)

Today I lost half of the day dealing with a nasty and horrible error, on a staging environment, trying to host Azure login pages locally instead that on the Azure ACS portal.

It was not working, even if it should be really, really trivial to setup. After dealing with the trace recorded by fiddler for a couple of hours I realized that the whole problem is related to the WIF configuration of the web application:

<add value="https://localhost/MyWebApp/" />
<issuerNameRegistry type="System.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, System.IdentityModel, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<add thumbprint="---" name="---" />
<certificateValidation certificateValidationMode="None" />
<cookieHandler requireSsl="false" path="/MyWebApp" />
<wsFederation passiveRedirectEnabled="true" issuer="http://----/wsFederationSTS/Issue" realm="https://localhost/MyWebApp/" requireHttps="false" />

Removing the “path” attribute from the “cookieHandler” element solved the problem immediately.

Developer advised… :-)