Thursday, 21 August 2014

Useful Code in order to Remove the Form based authentication Cookie..

        private static void ClearFormCookies()
            var context = HttpContext.Current;
            if (context == null || context.Request.Browser == null)
            var strB = string.Empty;
            if (context.Request.Browser["supportsEmptyStringInCookieValue"] == "false")
                strB = "NoCookie";
            if (context.Request.Cookies[FormsAuthentication.FormsCookieName] != null && string.Compare(context.Request.Cookies[FormsAuthentication.FormsCookieName].Value, strB, System.StringComparison.OrdinalIgnoreCase) != 0)
                context.Request.Cookies[FormsAuthentication.FormsCookieName].Value = strB;

No comments:

Post a Comment

Featured post

Getting Started With SOLR

Getting Started with Solr ·           Features o    Hit highlighting o    Auto correction o    Faceted Search o    Multi lan...