public ActionResult Login(LoginModel model, string returnUrl) { PlsUserAuthentication_Result rslt = db.PlsUserAuthentication(model.UserName, model.Password).FirstOrDefault(); if (rslt.Code != "000") { ModelState.AddModelError("", rslt.Message); //ViewBag.ImageList = imageList; return(PartialView(model)); } if (ModelState.IsValid && Membership.ValidateUser(model.UserName, model.Password)) { FormsAuthentication.SetAuthCookie(model.UserName, false); //Session["AgentId"] = rslt.AgentId; //Session["AgentName"] = rslt.AgentName; return(RedirectToAction("Main", "Secure")); } else { ModelState.AddModelError("", "The user name or password provided is incorrect."); //ViewBag.ImageList = imageList; return(PartialView(model)); } }
public override bool ValidateUser(string username, string password) { //ClsStatic.ResponseDetail response = new ClsStatic.ResponseDetail(); CobinDBCon con = new CobinDBCon(); PlsUserAuthentication_Result rslt = con.PlsUserAuthentication(username, password).FirstOrDefault(); if (rslt.Code == "000") { return(true); } //response.Code = rslt.Code; //response.Status = rslt.Status; //response.Message = rslt.Message; return(false); }