This documentation is archived and is not being maintained.

CookieContainer.PerDomainCapacity Property

Gets and sets the number of Cookie instances a CookieContainer can hold per domain.

[Visual Basic]
Public Property PerDomainCapacity As Integer
public int PerDomainCapacity {get; set;}
public: __property int get_PerDomainCapacity();
public: __property void set_PerDomainCapacity(int);
public function get PerDomainCapacity() : int;
public function set PerDomainCapacity(int);

Property Value

The number of Cookie instances allowed per domain.


Exception Type Condition
ArgumentOutOfRangeException PerDomainCapacity is less than or equal to zero


(PerDomainCapacity is greater than the maximum allowable number of cookies instances, 300, and is not equal to MaxValue)


If the new PerDomainCapacity value is less than the current value, and if any of the domain collections contain more Cookie instances than the new value, the collections are pruned to fit. This uses the same basic rules as described in the Capacity property. However, this does the clean-up only on the collection for this domain.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

CookieContainer Class | CookieContainer Members | System.Net Namespace | Cookie | CookieCollection | CookieContainer | CookieException