CookieHelp

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Cookie : System.Web.UI.Page
{

    protected void btnRead_Click(object sender, EventArgs e)
    {

        lblMessage.Text = CookieHelp.GetCookie("CheckCode");
       
    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {

        CookieHelp.SaveCookie("CheckCode", "xiang=" + DateTime.Now.ToString(),2);
       
    }
 
    protected void btnEncode_Click(object sender, EventArgs e)
    {
        lblMessage.Text =HttpUtility.UrlEncode(txtValue.Text);
    }
    protected void btnDecode_Click(object sender, EventArgs e)
    {
        lblMessage.Text = HttpUtility.UrlDecode(txtValue.Text);
    }


    //System.Web.Security.FormsAuthentication.SetAuthCookie( this.txtValue.Text, false);//登录...
    //将用户名写入cookies
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        CookieHelp.ClearCookie("CheckCode");
    }
}

posted on 2010-06-08 18:31  xrt2004  阅读(128)  评论(0编辑  收藏  举报

导航