CookieContainer.Add Method (Uri, Cookie)
[Visual Basic] Overloads Public Sub Add( _ ByVal uri As Uri, _ ByVal cookie As Cookie _ ) [C#] public void Add( Uri uri, Cookie cookie ); [C++] public: void Add( Uri* uri, Cookie* cookie ); [JScript] public function Add( uri : Uri, cookie : Cookie );
- The URI of the Cookie to be added to the CookieContainer.
- The Cookie to be added to the CookieContainer.
|ArgumentNullException||uri is a null reference (Nothing in Visual Basic)|
|ArgumentNullException||cookie is a null reference (Nothing in Visual Basic)|
If your URI corresponds to your local domain and sends to all the hosts on the local domain, set the Cookie Domain property equal to ".local". Otherwise, make sure it matches the host name used in the URI.
If the Count property equals the Capacity property, one or more Cookie instances are removed from the container before adding the cookie parameter. Enough Cookie instances are removed to bring Count below Capacity as follows: if there are expired instances in scope they are cleaned up. If not, then the least recently used CookieCollection is found and removed from the container.
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family