1

I am explicitly setting a cookie domain so it is shared between the domain and a sub domain. Think mysite.com and payment.mysite.com. Sometimes I get two session cookies when I only have one specified. When looking in firefox the domains on the cookies are different, one is "mysite.com" and the other is ".mysite.com" how does this happen? I am setting the domain to mysite.com but it is trimmed from one.

I am using asp.net.

Thanks

Rob Allen
  • 2,871
  • 2
  • 30
  • 48
  • Here is an answer: http://stackoverflow.com/questions/2172490/asp-net-subdomain-cookie-parent-and-one-subdomain – Kris Krause Mar 23 '12 at 14:55
  • i know how to share a cookie between two domains. The problem is that the preceeding '.' is removed from one. My title is unclear I suppose – Rob Allen Mar 23 '12 at 15:12
  • or rather I set it to mysite.com, but occasionally I end up with two cookies. one for mysite.com and one for .mysite.com – Rob Allen Mar 23 '12 at 15:17
  • Make sure you use the same domain when setting the cookie on both sites to Response.Cookies("domain").Domain = ".mysite.com"; – Kris Krause Mar 23 '12 at 15:36
  • yeah, i could swear to it that I do and it is a browser thing. I set a conditional breakpoint and it never gets hit – Rob Allen Mar 23 '12 at 15:43

1 Answers1

0

It depens what you specify as a domain in setcookie function. Please take a look at the description in here http://php.net/setcookie.

Kristijonas
  • 151
  • 1
  • 10