/// <summary> /// 设置Cookies /// </summary> /// <param name="CookiesName">Cookies名称</param> /// <param name="_strCookiesParm">Cookies键值</param> /// <returns></returns> private bool SetCookiesKeyValue(string CookiesName, Dictionary <string, string> CookiesParm) { bool flag = false; try { if (String.IsNullOrEmpty(CookiesName) || CookiesParm == null || CookiesParm.Count < 1) { return(false); } if (this.ExpiresTime < 1) { this.ExpiresTime = DefaultExpiresTime; } CookUtils.AddCookie(CookiesName, CookiesParm, DateTime.Now.AddHours(ExpiresTime)); flag = true; } catch (Exception ex) { LogService.logDebug(ex); } return(flag); }
/// <summary> /// 设置Cookies /// </summary> /// <param name="CookiesName">Cookies名称</param> /// <param name="CookiesValue">Cookies值</param> /// <returns></returns> private bool SetCookiesValue(string CookiesName, string CookiesValue) { bool flag = false; try { //过滤特殊字符 CookiesValue = CookiesValue.Replace("\r", "").Replace("\n", "").Replace("%0d%0a", ""); if (String.IsNullOrEmpty(CookiesName) || String.IsNullOrEmpty(CookiesValue)) { return(false); } if (this.ExpiresTime < 1) { this.ExpiresTime = DefaultExpiresTime; } CookUtils.AddCookie(CookiesName, CookiesValue, DateTime.Now.AddHours(ExpiresTime)); flag = true; } catch (Exception ex) { Log.LogService.logDebug(ex); } return(flag); }