国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

CookieHelper.cs

2019-11-14 10:25:33
字體:
來源:轉載
供稿:網友
using System;using System.Web;namespace Common{    public class CookieHelper    {        /// <summary>        /// 設置Cookie緩存        /// </summary>        /// <param name="sKey"></param>        /// <param name="sContent"></param>        /// <param name="dt"></param>        public static void CookieSet(string sKey,string sContent,DateTime dt)        {            HttpCookie myHttpCookie = new HttpCookie(sKey);            myHttpCookie.Value = sContent;            myHttpCookie.Expires = dt;            HttpContext.Current.Response.Cookies.Add(myHttpCookie);        }        /// <summary>          /// 清除指定Cookie          /// </summary>          /// <param name="sKey">cookiename</param>          public static void CookieClear(string sKey)        {            HttpCookie cookie = HttpContext.Current.Request.Cookies[sKey];            if (cookie != null)            {                cookie.Expires = DateTime.Now.AddYears(-3);                HttpContext.Current.Response.Cookies.Add(cookie);            }        }        /// <summary>          /// 獲取指定Cookie值          /// </summary>          /// <param name="sKey">cookiename</param>          /// <returns></returns>          public static string CookieGet(string sKey)        {            HttpCookie cookie = HttpContext.Current.Request.Cookies[sKey];            string str = string.Empty;            if (cookie != null)            {                str = cookie.Value;            }            return str;        }    }}
上一篇:Storm入門學習隨記

下一篇:洛谷 1372

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 凤山市| 大连市| 南华县| 阳曲县| 平凉市| 化隆| 吉林省| 汶上县| 贵溪市| 蛟河市| 元氏县| 溧水县| 天长市| 嘉祥县| 资中县| 陆良县| 广水市| 永安市| 德惠市| 东莞市| 项城市| 方山县| 青河县| 永兴县| 鸡东县| 海城市| 定南县| 天柱县| 海兴县| 东辽县| 聊城市| 高要市| 宝丰县| 呼和浩特市| 石楼县| 白玉县| 体育| 宁武县| 安顺市| 芮城县| 邢台市|