public static USERINFO Login(string UserName, string Password) { //#if DEBUG // Debugger.Launch(); //#endif string condition = ""; if (null != UserName && null != Password) { condition = "select*From userinfo where UserName='******'"; } DbSqlQuery <USERINFO> result1 = db.USERINFO.SqlQuery(condition, UserName); if (null != result1 && result1.Count() > 0) { USERINFO user = result1.First <USERINFO>(); if (null != user) { if (user.PASSWORD == Utils.md5Unicodebase64(Password)) { //if (user.PASSWORD == Password) return(user); } } } return(null); }
// GET: Home/Login public ActionResult Login(string username, string password) { Session.RemoveAll(); DatabaseContext userDbContext = new DatabaseContext(); DbSqlQuery <User> result = userDbContext.Users.SqlQuery("Select * from Users where username = @p0", username); if (!result.Any()) { return(Redirect("Index")); } if (result.First().Password != password) { return(Redirect("Index")); } Session.Add("userInfo", result.First()); return(Redirect("Info")); }