public ActionResult CheckUser(LoginModel loginModel) { string path = Server.MapPath("~/App_Data/users.xml"); UserList users = UserList.Load(path); if (users != null) { var user = users.Check(loginModel.Login, loginModel.Password); if (user != null) { Session.Add("User", user); return(RedirectToRoute(new { controller = "Home", action = "Index" })); } } ViewBag.Error = "Login or password incorrect"; return(View("Login")); }