예제 #1
0
 /// <summary>
 /// 反序列化cookie的值返回user对象
 /// </summary>
 /// <param name="cookieName">Cookie名</param>
 /// <returns></returns>
 public static T GetCookieVal <T>(string cookieName)
 {
     return(SerializeHelper.BinaryDeserializeBase64StringToObject <T>(GetCookieVal(cookieName)));
 }
예제 #2
0
 /// <summary>
 /// T对象序列化后写入cookie
 /// </summary>
 /// <param name="cookieName">Cookie名</param>
 /// <param name="targetObject">需要序列化的对象,必须标记了可被序列化</param>
 /// <param name="iExpires">COOKIE对象有效时间(分钟),1表示永久有效,0和负数都表示不设有效时间,大于等于2表示具体有效分钟,525600分=1年=(60*24*365)</param>
 public static void SetCookieVal <T>(string cookieName, T targetObject, int iExpires)
 {
     SetCookieVal(cookieName, iExpires, SerializeHelper.BinarySerializeObjectToBase64String <T>(targetObject));
 }