//ham lay gi tri cua mot cookie tu may client static public void getCookie(ref string MemberID, ref string Role) { if (HttpContext.Current.Request.Cookies["PSC_UIS"] != null) { MemberID = Encrypt_Decrypt.Instance().Decrypt(HttpContext.Current.Request.Cookies["PSC_UIS"]["1"].ToString()); Role = Encrypt_Decrypt.Instance().Decrypt(HttpContext.Current.Request.Cookies["PSC_UIS"]["2"].ToString()); } }
static public void writeCookie(string MemberID, string Role) { //encrypt. string encryptMemberID = Encrypt_Decrypt.Instance().Encrypt(MemberID); string encryptRole = Encrypt_Decrypt.Instance().Encrypt(Role); //set cookies. HttpContext.Current.Response.Cookies["PSC_UIS"]["1"] = encryptMemberID; HttpContext.Current.Response.Cookies["PSC_UIS"]["2"] = encryptRole; HttpContext.Current.Response.Cookies["PSC_UIS"].Expires = DateTime.Now.AddYears(1); }