I am trying to set the port in a cookie in ASP.NET (code below), but at runtime (below code) I get a very unusual error. Any thoughts?
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,
};
An exception:
System.Net.CookieException: The 'Port'='443' part of the cookie is invalid..
Edit: Sorry, I meant that I also tried Port = "80" without success.
source
share