문제

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