public JsonResult SignIn(string username, string password) { var den = DEncrypt.AesEncode(password); try { string str = " Mobile = '" + username + "' and pass = '******'"; //var res = doc.GetModelList(str); var res = doc.GetModelList(str).FirstOrDefault(); if (res != null) { Response.Cookies["user"].Value = res.ID + "," + res.Name; Response.Cookies["user"].Expires = DateTime.Now.AddDays(1); //HttpCookie aCookie = new HttpCookie("lastVisit"); //aCookie.Value = DateTime.Now.ToString(); //aCookie.Expires = DateTime.Now.AddDays(1); //Response.Cookies.Add(aCookie); } return(Json(res, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(ex.Message, JsonRequestBehavior.AllowGet)); } }