public ActionResult Login(FormCollection fnLogin) { Int64 PhoneNumber = Convert.ToInt64(fnLogin["txtPhoneNumber"]); Utility en = new Utility(); string PassWord = en.Encrypt(fnLogin["txtPassword"]); InformationServiceWrapper Obj = new InformationServiceWrapper(); UserDetailsModel ModelObj = new UserDetailsModel(); ModelObj = Obj.GetLoginCheck(PhoneNumber, PassWord); if (ModelObj.txtUserName != null) { HttpCookie KeyCookie = new HttpCookie("_RRPS"); HttpCookie UserIdCookie = new HttpCookie("_RRUID"); HttpCookie PhoneNumberCookie = new HttpCookie("_RRUPn"); HttpCookie UserNameCookie = new HttpCookie("_RRUN"); KeyCookie.Values["_RRPS"] = en.Encrypt(PassWord); UserIdCookie.Values["_RRUID"] = en.Encrypt(ModelObj.intUserId.ToString()); PhoneNumberCookie.Values["_RRUPn"] = en.Encrypt(fnLogin["txtPhoneNumber"]); if (ModelObj.txtUserName.Length <= 10) { UserNameCookie.Values["_RRUN"] = ModelObj.txtUserName; } else { UserNameCookie.Values["_RRUN"] = ModelObj.txtUserName.Substring(0, 10) + ".."; } KeyCookie.Expires = DateTime.Now.AddDays(365); UserIdCookie.Expires = DateTime.Now.AddDays(365); PhoneNumberCookie.Expires = DateTime.Now.AddDays(365); UserNameCookie.Expires = DateTime.Now.AddDays(365); Response.Cookies.Add(KeyCookie); Response.Cookies.Add(UserIdCookie); Response.Cookies.Add(PhoneNumberCookie); Response.Cookies.Add(UserNameCookie); return(Json(ModelObj.txtUserName, JsonRequestBehavior.AllowGet)); } else { return(Json("", JsonRequestBehavior.AllowGet)); } }