cookie在.net中的使用
1.创建一个新的cookie,并赋值。
HttpCookie cookie;
cookie=new HttpCookie("user");
cookie.Domain = AppConfig.DomainName;
cookie.Values.Add("Username",username);
cookie.Values.Add("ldapStr",FindUserlist.Table.Rows[0]["ldapStr"].ToString());
Response.AppendCookie(cookie);
2.获取cookie的值
HttpCookie cookie=Request.Cookies["user"];
if(cookie!=null)
{
string username = cookie["Username"];
string ldapStr = cookie["ldapStr"];
}