IE9 FormsAuthentication

时间:2011-03-17 23:34:26

标签: asp.net-mvc-2 forms-authentication internet-explorer-9

我今天设置了IE9,我的FormsAuthentication停止工作。 我的步骤 - 在Visual Studio 2010中创建ASP.NET MVC2应用程序,向HomeController添加Authorize属性,打开AccontController并注释第44,56,58行。按F5输入用户/用户并按ENTER键,IE9不向HomeController发送认证cookie < / p>

    [HandleError, Authorize]
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewData["Message"] = "Welcome to ASP.NET MVC!";

            return View();
        }
    }

    [HttpPost]
    public ActionResult LogOn(LogOnModel model, string returnUrl)
    {
    if (ModelState.IsValid)
    {
            //if (MembershipService.ValidateUser(model.UserName, model.Password))
            {
                FormsService.SignIn(model.UserName, model.RememberMe);
                if (!String.IsNullOrEmpty(returnUrl))
                {
                    return Redirect(returnUrl);
                }
                else
                {
                    return RedirectToAction("Index", "Home");
                }
            }
            //else
            {
                //ModelState.AddModelError("", "The user name or password provided is incorrect.");
            }
        }

        // If we got this far, something failed, redisplay form
        return View(model);
    }

1 个答案:

答案 0 :(得分:0)

无法重现。对我来说效果很好。您的设置必定存在其他问题。您是否验证了Cookie是否已启用?