public ActionResult Login(Userlogin user) { var obj = new Userlogin(); obj.Email = user.Email; obj.Password = user.Password; byte[] temp; SHA1 sha = new SHA1CryptoServiceProvider(); temp = sha.ComputeHash(Encoding.UTF8.GetBytes(user.Password)); StringBuilder sb = new StringBuilder(); for (int i = 0; i < temp.Length; i++) { sb.Append(temp[i].ToString("x2")); } string hash = sb.ToString(); var psw = lodinDb.LogUser(obj.Email); psw = psw.Replace(" ", String.Empty); if (psw != null) { if (psw.Equals(hash)) { string[] arr = { hash, obj.Email }; Session["UserMail"] = user.Email; return(Json(new { Items = arr })); } else { return(null); } } else { return(null); } }