// 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, 在此先感谢您的帮助。