In this case, your domain will be the same as localhost, so there should be no problems.
Another thing: the port is part of the URI, not the domain, the domain is also part of the URI, so you mix apples and fruits ...
Refer to this other question in SO
rfc clearly states
Introduction
cookie . , , "" , Secure . , cookie , " ", -, , .
.
( ),
var testCookie1 = new HttpCookie("Test", "testValue");
testCookie1.Domain = "." + mydomain;
, x.mydomain y.mydomain cookie.
, cookie localhost ipaddress.
, :
127.0.0.1 myawesomesubdomain.thisdomainnotexist.com.tr
cookie