App_Code/Common/Cookies.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Text;
using System.Web;

namespace NT.Common
{
    public class NTCookies
    {
        public string cookiename = "NTCookies";
        public HttpCookie cookie = null;
        private string m_domain;

        /// <summary>
        /// 获取或设置与此 Cookie 与其关联的域
        /// </summary>
        public string Domain
        {
            get { return m_domain; }
            set
            {
                m_domain = value;
                cookie.Domain = m_domain;
            }
        }

        public NTCookies()
        {
            cookie = HttpContext.Current.Request.Cookies[cookiename];
            if (cookie == null)
            {
                cookie = new HttpCookie(cookiename);
            }
        }

        public NTCookies(string cookiename)
        {
            this.cookiename = cookiename;
            cookie = HttpContext.Current.Request.Cookies[cookiename];
            if (cookie == null)
            {
                cookie = new HttpCookie(cookiename);
            }
        }

        /// <summary>
        /// 写入cookies
        /// </summary>
        /// <param name="strKey">键</param>
        /// <param name="strValue">值</param>
        public void WriteCookie(string strKey, string strValue)
        {
            cookie[strKey] = strValue;
        }
        /// <summary>
        /// 写入指定有效时间的cookies
        /// </summary>
        /// <param name="strKey">键</param>
        /// <param name="strValue">值</param>
        /// <param name="expires">有效时间</param>
后面还有 51 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。