1

I am using SharePoint 2010. There is one cookie that the application creates upon first visit to the site.

If I go to http://www.sharepointsite.com, the cookie is created no problem.

After it is created, I go to any page directly without the 'www' in the url (ie. http://sharepointsite.com/site/Pages/page1.aspx), and the cookie that was created is not there, and gets created.

If i navigate to the same url with 'www' in the url (ie. http://www.sharepointsite.com/site/Pages/page1.aspx), the cookie is there.

Is there any reason why my cookies would show up for http://www.sharepointsite.com, but not http://sharepointsite.com?

2

By default cookies are scoped to the EXACT host you provided. The subdomains you provided are different. You can explicitly define that a cookie is good for the whole domain by using a domain directive while setting the cookie. An example of this is available here:

https://stackoverflow.com/questions/18492576/share-cookie-between-subdomain-and-domain

  • I tried that, however it creates two cookies one for sharepointsite.com and www.sharepointsite.com, and when I update the cookie with a value, it does not set. Also, that is for subdomains. Setting a cookie without specifying it's domain should set for with and without a dot, by default from what I remember. – TeddyRuxpin Jun 7 '15 at 3:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.