/// <summary> /// 手持设备添加cookies /// </summary> /// <param name="loginId"></param> /// <param name="passWord"></param> /// <param name="connectionString"></param> public static void SetPadCookies(string loginId, string passWord) { try { HttpCookie userInfo = new HttpCookie("userInfo"); StringCipherCls sc = new StringCipherCls(); sc.StringCipher(ref loginId, sc.Key); sc.StringCipher(ref passWord, sc.Key); userInfo.Values[LoginID] = loginId; userInfo.Values[Password] = passWord; userInfo.Expires = DateTime.MaxValue; System.Web.HttpContext.Current.Response.Cookies.Add(userInfo); } catch (Exception ex) { throw ex; } }
/// <summary> /// 获取zhidingcookies与内容作对比 /// </summary> /// <param name="strName"></param> /// <param name="strValue"></param> /// <returns></returns> public static bool CompareCookies(string strName, string strValue) { try { StringCipherCls sc = new StringCipherCls(); sc.StringCipher(ref strValue, sc.Key); return(GetCookiesValue(strName).Equals(strValue)); } catch { return(false); } }