代码
public string GetCookie(string cookie)
{
if (Request.Cookies[cookie] != null)
return Request.Cookies[cookie].Value;
return string.Empty;
}
public void SetCookie(string cookieName, string cookieValue, int expireDate)
{
HttpCookie cookie = new HttpCookie(cookieName);
cookie.Expires = DateTime.Now.AddDays(expireDate);
cookie.Value = cookieValue;
Response.Cookies.Add(cookie);
}
{
if (Request.Cookies[cookie] != null)
return Request.Cookies[cookie].Value;
return string.Empty;
}
public void SetCookie(string cookieName, string cookieValue, int expireDate)
{
HttpCookie cookie = new HttpCookie(cookieName);
cookie.Expires = DateTime.Now.AddDays(expireDate);
cookie.Value = cookieValue;
Response.Cookies.Add(cookie);
}