Adds a System.Net.Cookie to the System.Net.CookieContainer for a particular URI.
- uri
- The URI of the System.Net.Cookie to be added to the System.Net.CookieContainer.
- cookie
- The System.Net.Cookie to be added to the System.Net.CookieContainer.
If you add a System.Net.Cookie instance for just one specific host, do not set the Cookie.Domain property of the System.Net.Cookie instance. This is set automatically, based on the URI.
If your URI corresponds to your local domain and sends to all the hosts on the local domain, set the System.Net.Cookie Cookie.Domain property equal to ".local". Otherwise, make sure it matches the host name used in the URI.
If the Cookie.Version property of a System.Net.Cookie is Netscape, the Cookie.Path property of the System.Net.Cookie, if not set explicitly, is derived from the URI and is the complete path from the URI, including the page name.
If the CookieContainer.Count property equals the CookieContainer.Capacity property, one or more System.Net.Cookie instances are removed from the container before adding the cookie parameter. Enough System.Net.Cookie instances are removed to bring CookieContainer.Count below CookieContainer.Capacity as follows: if there are expired instances in scope, they are cleaned up. If not, then the least recently used System.Net.CookieCollection is found and removed from the container.