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

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

CookieHelper.cs

2019-11-14 11:50:02
字體:
來源:轉載
供稿:網友
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;        }    }}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 兴业县| 阿勒泰市| 霍州市| 淮南市| 自贡市| 龙山县| 闽侯县| 乌兰察布市| 托克逊县| 栖霞市| 横山县| 襄汾县| 英超| 阜阳市| 松江区| 盱眙县| 宿迁市| 梅河口市| 通道| 乌拉特前旗| 朔州市| 马关县| 大余县| 库尔勒市| 博爱县| 弥渡县| 互助| 扎赉特旗| 定安县| 麻江县| 金塔县| 塔河县| 蚌埠市| 安溪县| 精河县| 龙门县| 晋城| 巨鹿县| 浦北县| 托克逊县| 宁城县|