I currently have 3 websites in need of storing a cookie that can be accessed by each site. I have created a single ASPX file to handle the storage of this cookie for all 3 sites. On every page of these websites, there is JavaScript code calling the ASPX file to save the cookie. However, even though the ASPX file is on one domain and loaded as an image, why are the cookies not being written to the same location? Here is a breakdown:
We have X.com, Y.com, and Z.com as the three existing sites.
Y.com/cookiesave.aspx is also present and it creates a cookie named "bob" with a unique identifier if it does not already exist.
On each page of X.com, Y.com, and Z.com, there is JavaScript code loading an image from Y.com/cookiesave.aspx which returns a transparent 1x1 pixel image. Despite this, the cookies seem to be saved and accessed separately by each site. How does the script differentiate between the sites, especially when it is hosted on Y.com only?