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

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

CookieHelper.cs

2019-11-14 10:54:32
字體:
來源:轉載
供稿:網友
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;        }    }}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 任丘市| 通河县| 洛阳市| 柳州市| 西峡县| 和静县| 天津市| 曲松县| 武强县| 顺义区| 漠河县| 靖宇县| 阳西县| 万安县| 阜新市| 扬中市| 金堂县| 永济市| 庆阳市| 安阳县| 和硕县| 长宁区| 香格里拉县| 太仆寺旗| 宜城市| 施秉县| 东乡| 柏乡县| 康保县| 前郭尔| 葵青区| 黔西| 三都| 满洲里市| 聂拉木县| 金坛市| 灵山县| 吴旗县| 竹北市| 新郑市| 凌云县|