国产探花免费观看_亚洲丰满少妇自慰呻吟_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

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 嘉荫县| 承德县| 和平县| 巴林右旗| 盐山县| 永平县| 天峨县| 大关县| 铁岭县| 滦平县| 河津市| 抚宁县| 汽车| 讷河市| 海南省| 扶沟县| 大港区| 石屏县| 武鸣县| 衡东县| 余姚市| 馆陶县| 昌宁县| 新源县| 南康市| 吉木乃县| 碌曲县| 东安县| 衡阳县| 垦利县| 彭州市| 湟中县| 炉霍县| 康乐县| 泸溪县| 邵武市| 斗六市| 玉林市| 太谷县| 金平| 霍城县|