Я получил ошибку в своем приложении MVC4 относительно веб-безопасности.
Мой код ниже....
public ActionResult Login(user model, string returnUrl="/Home") { if (ModelState.IsValid && WebSecurity.Login(model.UserFirstName, model.Password)) { return RedirectToLocal(returnUrl); } // If we got this far, something failed, redisplay form ModelState.AddModelError("", "The user name or password provided is incorrect."); return View(model); }
И ошибка есть..
You must call the "WebSecurity.InitializeDatabaseConnection" method before you call any other method of the "WebSecurity" class. This call should be placed in an _AppStart.cshtml file in the root of your site.