不言自明。在 PHP 中,解决方案是将 cookie 过期时间设置为 0;我不确定 C#,因为它需要 DateTime 值。
最佳答案
Cookie.Expires 的文档马上说出来。
Setting the Expires property to MinValue makes this a session Cookie, which is its default value.
cookie.Expires = DateTime.MinValue
关于c# - 如何在 C# 中将 cookie 过期时间设置为 "session"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1780469/