ASP.NETでCookieの有効期限を本日限りに設定


開発メモ

//有効期限を設定
var expires = DateTime.Today.AddDays(1);

var cookie = new HttpCookie("hoge")
{
    Value = "本日限り",
    Expires = expires,
    HttpOnly = true
};
HttpContext.Response.Cookies.Add(cookie);

 
FireFoxで確認