Intermittently our External authentication cookies are not returning. We are using
- OWIN as the middleware layer
- .Net 4.62
- SessionState
- Systain SAML
- 2 IIS Web Servers
The following links refer to what I believe the problem is
http://appetere.com/post/owinresponse-cookies-not-set-when-remove-an-httpresponse-cookie
ASP.NET_SessionId + OWIN Cookies do not send to browser
I've tried setting the session as follows Session["Workaround"] = 0;
We initialize the Cookie as follows
public void ConfigureAuth(IAppBuilder app)
{
app.UseExternalSignInCookie("ExternalCookie");
...etc
On the callback we get the result as follows
AuthenticateResult authenticateResult = await this.AuthenticationManager.AuthenticateAsync("ExternalCookie");
I'd like to try using the following mentioned in the links above to resolve it OnSendingHeaders(state => {...
but I'm unsure of how to implement it