⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cookie.aspx.cs

📁 小说网(c#)版源程序,学习还是不错滴,大家可以下载下来看看.
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class cookie : System.Web.UI.Page
{
    protected DataTable table;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.Cookies["topicid"] != null)
        {
            //是否删除单个Cookie图书
            if (Request.QueryString["deltopicid"] != null && Regular.IsId(Request.QueryString["deltopicid"].ToString()))
            {
                Response.Cookies["topicid"].Value = Request.Cookies["topicid"].Value;
                Response.Cookies["topicid"].Values.Remove(Request.QueryString["deltopicid"].ToString());
                if(Response.Cookies["topicid"].Values.Count==0)
                    Response.Cookies["topicid"].Expires = DateTime.Now.AddYears(-1);
                Response.Redirect("cookie.aspx");
            }
            table = new DataTable();
            table.Columns.Add("topicid");
            table.Columns.Add("title");
            //分解Cookie,数据绑定
            string[] cookie = Request.Cookies["topicid"].Value.Split('&');
            for (int i = 0; i < cookie.Length; i++)
                table.Rows.Add(new string[2] { Server.HtmlEncode(cookie[i].Split('=')[0]), HttpContext.Current.Server.UrlDecode(Server.HtmlEncode(cookie[i].Split('=')[1])) });
            this.List_Cookie.DataSource = table;
            this.List_Cookie.DataBind();
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -