首页 > 代码库 > C#中Cookies的存取

C#中Cookies的存取

<1>

C#中Cookies的存取

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace WebApplication1
{
    public class FunCookie
    {
        /// <summary>
        /// 创建Cookie和赋值,及设计Cookie有效天数
        /// </summary>
        /// <param name="strCookieName">Cookie名字</param>
        /// <param name="strCookieValue">Cookie的值</param>
        /// <param name="intDay">Cookie有效天数</param>
        /// <returns>布尔值</returns>
        public static bool SetCookie(string strCookieName,string strCookieValue,int intDay )
        {
            try
            {
                HttpCookie cookie = new HttpCookie(strCookieName); //创建一个cookie对象
                cookie.Value = http://www.mamicode.com/strCookieValue; //设置cookie的值>

C#中Cookies的存取