写入Cookie
写入Cookie
private void SetCookie(string domain)
{
HttpCookie cookie = new HttpCookie("token");
if (!string.IsNullOrEmpty(domain))
cookie.Domain = domain;
cookie.Path = "/";
cookie.Expires = DateTime.Now.AddDays(7);
cookie.Values.Add("key", "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
Response.Cookies.Add(cookie);
}
{
HttpCookie cookie = new HttpCookie("token");
if (!string.IsNullOrEmpty(domain))
cookie.Domain = domain;
cookie.Path = "/";
cookie.Expires = DateTime.Now.AddDays(7);
cookie.Values.Add("key", "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
Response.Cookies.Add(cookie);
}