Пример #1
0
 /// <summary>
 /// 读取Cookie某个对象的Value值,返回Value值,如果对象本就不存在,则返回null
 /// </summary>
 /// <param name="cookiesName">Cookie对象名称</param>
 /// <returns>返回对象的Value值,返回Value值,如果对象本就不存在,则返回null</returns>
 public static string GetCookies(string cookiesName)
 {
     if (HttpContext.Current.Request.Cookies[cookiesName] == null)
     {
         return(null);
     }
     else
     {
         return(CoralSecurity.DesDecrypt(HttpContext.Current.Request.Cookies[cookiesName].Value));
     }
 }
Пример #2
0
 /// <summary>
 /// 判断Cookie的某个键是否存在
 /// </summary>
 /// <param name="cookiesName">Cookie对象名称</param>
 /// <param name="keyName">键值</param>
 /// <returns></returns>
 public static bool ExistCookies(string cookiesName, string keyName)
 {
     if (HttpContext.Current.Request.Cookies[cookiesName] == null)
     {
         return(false);
     }
     else
     {
         var strObjValue = CoralSecurity.DesDecrypt(HttpContext.Current.Request.Cookies[cookiesName].Value);
         var strKeyName2 = keyName + "=";
         return(strObjValue.IndexOf(strKeyName2, StringComparison.Ordinal) != -1);
     }
 }
Пример #3
0
 public void PreAnalysis()
 {
     if (!UnEncoded && !string.IsNullOrEmpty(NameOrConnectionString))
     {
         NameOrConnectionString = CoralSecurity.DesDecrypt(NameOrConnectionString);
     }
     if (!UnEncoded && !string.IsNullOrEmpty(ReadConnectionString))
     {
         ReadConnectionString = CoralSecurity.DesDecrypt(ReadConnectionString);
     }
     if (!UnEncoded && !string.IsNullOrEmpty(WriteConnectionString))
     {
         WriteConnectionString = CoralSecurity.DesDecrypt(WriteConnectionString);
     }
     if (CommandTimeout == 0)
     {
         CommandTimeout = 30;
     }
 }
Пример #4
0
 /// <summary>
 /// 读取Cookie某个对象的Value值,返回Value值,如果对象本就不存在,则返回null
 /// </summary>
 /// <param name="cookiesName">Cookie对象名称</param>
 /// <param name="keyName">键值</param>
 /// <returns>返回对象的Value值,返回Value值,如果对象本就不存在,则返回null</returns>
 public static string GetCookies(string cookiesName, string keyName)
 {
     if (HttpContext.Current.Request.Cookies[cookiesName] == null)
     {
         return(null);
     }
     else
     {
         string strObjValue = CoralSecurity.DesDecrypt(HttpContext.Current.Request.Cookies[cookiesName].Value);
         string strKeyName2 = keyName + "=";
         if (strObjValue.IndexOf(strKeyName2) == -1)
         {
             return(null);
         }
         else
         {
             return(CoralSecurity.DesDecrypt(HttpContext.Current.Request.Cookies[cookiesName][keyName]));
         }
     }
 }