我想在ASP.NET(下面的代码)的cookie上设置端口,但我在运行时(代码下)得到一个非常不寻常的错误。有什么想法吗?设置Cookie端口
target.Cookie = new Cookie
{
Comment = "Test Comment",
CommentUri = new System.Uri("http://www.tempuri.org"),
Discard = false,
Domain = "tempuri.com",
Expired = false,
Expires = new DateTime(2015, 12, 31),
HttpOnly = false,
Name = "TestCookie",
Path = "/",
Port = "443",
Secure = false,
Value = "Test Value",
Version = 1,
};
例外:
System.Net.CookieException: The 'Port'='443' part of the cookie is invalid..
编辑: 对不起,我的意思是提到我也试着港口= “80”,但没有成功。
对不起,我的意思是补充一点,我试过端口=“80”没有成功,这不应该要求安全= true – CodeMonkey1313 2010-03-09 03:54:20
是否有一个特定的原因,你设置cookie的端口?对于网络请求它将超过80或443.这些不会改变。 – Brownman98 2010-03-10 02:56:19