开发者

Read cookie created by Java app from Asp.Net

I'm trying to read a cookie created by a Java app from Asp.Net but not having much luck

I'm using this line of code:

string CoockieValue = Response.Cookies["Cookie_Name"].Value;

Is this possible at all ?

We basically have an authentication web ui developed in java and开发者_运维问答 there is a url that takes to an Asp.Net page that needs to read this cookie

Please advise

Thanks!


Is this possible at all ?

Yes, if both applications are hosted on the same domain. If not, then, no, it is not possible. When setting a cookie there are 2 properties: path and domain which could be specified in order to limit the scope of the cookie.

So for example when in your Java application you set the cookie with domain="foo.com", all application on any subdomain on foo.com will be able to read it. So if you Java application is hosted on java.foo.com and your ASP.NET application is hosted on asp.foo.com it will be able to access it.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜