开发者

Asp.net HttpCookie specify port

Is there a way to specify the port for a HttpCookie?

I have a site that is available at sub.example.com and needs to be deployed at sub.example.com:81 and sub.example.com:82.(so the same domain, different ports -- using Apache2 and mono)

The authentication is done by using cookies specifying the domain and path:

sub.example.com (domain = "sub.example.com" path = "/")
sub.example.com:81 (domain = "sub.example.com:81" path = "/") 
sub.example.com:82 (domain = "sub.example.com:82" path = "/")
// seems that the port in domain is not used... 

All works fine for sub.example.com, but wh开发者_开发问答en logged on sub.example.com, the page at sub.example.com:81 also receives the 'authentication' cookie set by sub.example.com.

So I want to be able to specify also the port to a httpCookie, to restricts the ports to which this Cookie may be sent. Or maybe there is a workaround to simulate this...


Just for clarity - no, it's not possible when using HttpCookie.


When creating the cookie, you can set the Port-property of the Cookie to the correct port.

More info can be found at: http://msdn.microsoft.com/en-us/library/system.net.cookie.port%28VS.80%29.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜