Cookies; a.x.com reading cookie from b.x.com?
Lets say my website domain name is x.com, and the main site runs off www.x.com
Then lets say I have a subdomain, lets call it xml.x.com
Is it possible for xml.x.com to read a cookie saved by www.x.com?
This is for authentication and to allow SSO to happen.
Re: Cookies; a.x.com reading cookie from b.x.com?
Actually now that I think about it - when somebody logs in I can set a cookie and also set their Session() variable with the user ID. When they move onto a subdomain, I can check for the cookie and/or the session ID.
That's my problem resolved then isn't it?
Re: Cookies; a.x.com reading cookie from b.x.com?
Quote:
Originally Posted by plenderj
Actually now that I think about it - when somebody logs in I can set a cookie and also set their Session() variable with the user ID. When they move onto a subdomain, I can check for the cookie and/or the session ID.
That's my problem resolved then isn't it?
This is from MSDN which shows how to share cookies between domain/sub-domains.
http://msdn.microsoft.com/library/de...Cookies101.asp
Quote:
Scoping Cookies to a Domain
By default, cookies are associated with a specific domain. For example, if your site is
www.contoso.com, the cookies you write are sent to the server when users request any page from that site. (Except for cookies with a specific path value, as I explained in the section immediately preceding.) If your site has subdomains — for example, contoso.com, sales.contoso.com, and support.contoso.com — then you can associate cookies with a specific subdomain. To do so, set the cookie's Domain property, like this:
Code:
Response.Cookies("domain").Value = DateTime.Now.ToString
Response.Cookies("domain").Expires = DateTime.Now.AddDays(1)
Response.Cookies("domain").Domain = "support.contoso.com"
When the domain is set in this way, the cookie will be available only to pages in the specified subdomain.
You can also use the Domain property to create a cookie that can be shared among multiple subdomains. For example, set the domain as follows:
Code:
Response.Cookies("domain").Value = DateTime.Now.ToString
Response.Cookies("domain").Expires = DateTime.Now.AddDays(1)
Response.Cookies("domain").Domain = "contoso.com"
The cookie will then be available to the primary domain as well as to sales.contoso.com and support.contoso.com.