我想在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