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.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)