62,272
社区成员
发帖
与我相关
我的任务
分享
public static void setCookie(string key, string value, int timeout)
{
try
{
HttpCookie cookie = new HttpCookie(key);
value = HttpUtility.UrlEncodeUnicode( value );
cookie.Value = value;
cookie.Domain = ".99tjq.com";
cookie.Secure = false;
if (timeout != 0)
cookie.Expires = DateTime.Now.AddHours(Convert.ToInt32(timeout));
HttpContext.Current.Response.Cookies.Add(cookie);
}
catch
{
}
}
public static void KillCookie(string key)
{
HttpCookie cookie = new HttpCookie(key);
cookie.Expires = DateTime.Now.AddDays(-1.0);
HttpContext.Current.Response.Cookies.Add(cookie);
}