是否可以在会话结束时或特定时间使cookie过期? 最佳答案 是的!这很简单
HttpCookie newCookie = new HttpCookie("myCookie");
newCookie.Expires = DateTime.Today.AddDays(1);
如果您希望cookie用于会话,请将其设置为DateTime.MinValue.有关详细信息,请参阅MSDN文档here.这是摘录:
Setting the Expires property to MinValue makes this a session Cookie,
which is its default value.