From 657e0ed3388fdfe85127e19e2d9aa22544f492b1 Mon Sep 17 00:00:00 2001 From: jcovey Date: Wed, 6 Jan 2021 10:16:06 -0500 Subject: [PATCH] committing change to address bug with IE 11. --- DotNetCasClient/CasAuthentication.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/DotNetCasClient/CasAuthentication.cs b/DotNetCasClient/CasAuthentication.cs index af77160..d9d0e9c 100644 --- a/DotNetCasClient/CasAuthentication.cs +++ b/DotNetCasClient/CasAuthentication.cs @@ -1088,12 +1088,20 @@ public static void SetAuthCookie(FormsAuthenticationTicket clientTicket) } // Obtain the forms authentication cookie from the ticket + HttpCookie oldCookie = current.Response.Cookies[FormsAuthentication.FormsCookieName]; HttpCookie authCookie = GetAuthCookie(clientTicket); - // Clear the previous cookie from the current HTTP request - current.Request.Cookies.Remove(FormsAuthentication.FormsCookieName); - // Store the new cookie in both the request and response objects - current.Request.Cookies.Add(authCookie); - current.Response.Cookies.Add(authCookie); + if (oldCookie != null) + { + //In IE 11, the cookie value is null and we are resetting it here. + current.Response.Cookies[FormsAuthentication.FormsCookieName].Value = authCookie.Value; + current.Request.Cookies[FormsAuthentication.FormsCookieName].Value = authCookie.Value; + + } + else + { + current.Request.Cookies.Add(authCookie); + current.Response.Cookies.Add(authCookie); + } } ///