I don't think that the Virtual Dir part is important; it's the first part (domain name / machine name) that determines what cookies are sent by the browser.
A Web farm usually consists of 2 or more computers, orchestrated by some form of load balancing. Consider a simple scenario:
1. You go to
www.microsoft.com\default.asp
2. You arrive at a load balancing machine
3. This machine determines you are redirected to the machine WebServer1 (invisibly; your browser thinks it gets its content from
www.microsoft.com
4. You request another page, for example
www.microsoft.com\NewApp\default.asp
5. The load balancer can send you to WebServer2, or WebServer3 or wherever it wants for your new request.
All these machines will be able to read the same cookies, meant for microsoft.com (that is, if their path has been set to /) Even if the actual Web site is served up by multiple machines, all that the browser knows is that it is dealing with
www.microsoft.com. So, even if you visit \NewApp\, all microsoft.com cookies are visible.
However, should you decide to visit
www.msn.com, another Microsoft site, that site won't be able to read the Microsoft cookies.
So, what's important is the first part (domain name + tld, or machine name) that determines the scope of the cookie.
In your scenario, if you want to have two applications share the same login credentials, this will work (At least, I
think it will work, with the solution you posted earlier):
http://MyMachine1\MyApp1
http://MyMachine1\MyApp2
For both applications, the browser will see that the request for the cookie comes from MyMachine1, so it happily passes them up (again, provided that the cookies has been set to /)
However, this won't work:
http://MyMachine1\MyApp1
http://MyMachine2\MyApp1
Your browser will see that MyMachine1 is different from MyMachine2, just as
www.microsoft.com is different from
www.msn.com, and it won't pass up the cookies that has been set by MyMachine1, even if both applications share the same application name (MyApp1).
So, in order for this to work, I think you'll need to have your two applications listen to the same address; starting with
http://MyMachine1, for example.
Whether, under the hood, these two application consist of 1, 2 ot 10,000 different Web servers is entirely up to you. What's important is that the browser thinks it's dealing with only one machine.
Does this clarify things?
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.