public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Response.Cookies["name"] != null)
{
Server.Transfer("Default2.aspx");
}
}
}
protected void Button1_Click(object sender, EventArgs e)
{
if (TextBox1.Text != "")
{
Response.Cookies["name"].Value = TextBox1.Text;
Response.Cookies["name"].Expires = DateTime.Now.AddDays(1);
Server.Transfer("Default2.aspx");
}
}
}
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Response.Cookies["name"] != null && Response.Cookies["name"].Value != "")
{
Label1.Text = Response.Cookies["name"].Value;
}
}
}
这样,基本的功能就应该可以了