I'm using MVC3 and I use the following code to authenticate users:

        var host = HttpContext.Current.Request.Url.Host;
        Match match = Regex.Match(host, "([^.]+\\.[^.]{1,3}(\\.[^.]{1,3})?)$");
        string domain = match.Groups[1].Success ? match.Groups[1].Value : host;

        HttpCookie authcookie = FormsAuthentication.GetAuthCookie(userName, rememberMe);
        authcookie.Domain = domain;
        HttpContext.Current.Response.AppendCookie(authcookie);

        if (!string.IsNullOrEmpty(returnUrl))
            HttpContext.Current.Response.Redirect(returnUrl);

It works fine on Chrome, but I have a problem on IE11. IE sends old and new .ASPXAUTH cookies and asp fails to authenticate users:

enter image description here

Whats wrong with the code or the logic?

有帮助吗?

解决方案

Your ASP.NET version is not up to date on the latest patches and doesn't recognize IE11 as a browser that supports cookies.

If you don't have any control over the server you can change the <forms ...> element in your web.config file and add cookieless="UseCookies" to it.

More info about the patches on Scott Hanselman's blog.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top