Set Domain on ASP Session Cookie

Tag: cookies , asp-classic Author: SRmosel Date: 2010-06-28

How do I set the domain on the session cookie generated by classic ASP?

I'm using 2 urls for my site, www.example.com and shop.example.com and I need the session cookie sent to both.

Other Answer1

You should set it to:

Response.Cookies("YourCookieName").domain = ".example.com"

Note the leading "."

comments:

I'm try to set the domain on the session cookie created by ASP, not a cookie I create.
Wrong answer, that only effects actual cookies not the one created by ASP session storage. Classic asp does not allow you to change the session domain The only real alternative is to use a db session store with traditional cookies. Probably a better move since it will allow you to scale beyond one server.