📄 cookie.aspx.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 + -