📄 cookie.aspx.cs
字号:
using System;
using System.Data;
using System.Configuration;
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 _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnlog_Click(object sender, EventArgs e)
{
string name = "admin";
string pass = "admin";
if (this.TextBox1.Text == "admin" && this.TextBox2.Text == "admin")
{
if (this.RadioButtonList1.SelectedValue.ToString() == "1")
{
this.Response.Cookies["UserName"].Expires = DateTime.Now.AddDays(1);
this.Response.Cookies["Password"].Expires = DateTime.Now.AddDays(1);
}
if (RadioButtonList1.SelectedValue.ToString() == "2")
{
this.Response.Cookies["UserName"].Expires = DateTime.Now.AddMonths(1);
this.Response.Cookies["Password"].Expires = DateTime.Now.AddMonths(1);
}
if (RadioButtonList1.SelectedValue.ToString() == "3")
{
this.Response.Cookies["UserName"].Expires = DateTime.Now.AddYears(1 / 2);
this.Response.Cookies["Password"].Expires = DateTime.Now.AddYears(1 / 2);
}
if (RadioButtonList1.SelectedValue.ToString() == "4")
{
this.Response.Cookies["UserName"].Expires = DateTime.Now.AddYears(1);
this.Response.Cookies["Password"].Expires = DateTime.Now.AddYears(1);
}
this.Response.Cookies["UserName"].Value = this.TextBox1.Text;
this.Response.Cookies["Password"].Value = this.TextBox2.Text;
Response.Redirect("getcookie.aspx");
}
else
{
Response.Redirect("cookie.aspx");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -