在IE中,Request.IsAuthenticated始终为false(8)

时间:2013-07-15 04:40:56

标签: asp.net-mvc-3 validation

AccountController中的登录操作

                // Logon Logic.

                FormsAuthentication.SetAuthCookie(model.UserInfo, model.RememberMe);

                if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/")
                    && !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\"))
                {
                    return Redirect(returnUrl);
                }
                else
                {
                    return RedirectToAction("Index", "Home");
                }

Web.Config


<authentication mode="Forms">
  <forms name="TestRadarManager" loginUrl="~/Account/LogOn" timeout="2880" slidingExpiration="false" />
</authentication>

HomeIndex.cshtml


@if (Request.IsAuthenticated)
                {
                    <span>Welcome,</span><b>@Context.User.Identity.Name</b>
                }

它在FF浏览器中工作正常,但无论如何,在IE中Request.IsAuthenticated始终为false, 在此先感谢您的帮助。

0 个答案:

没有答案