The <xref:System.Net.CookieContainer> has three properties that govern the volume of the content of the container: <xref:System.Net.CookieContainer.Capacity%2A>, <xref:System.Net.CookieContainer.MaxCookieSize%2A>, and <xref:System.Net.CookieContainer.PerDomainCapacity%2A>. These values have the default settings of 300, 4096, and 20 respectively. When a <xref:System.Net.Cookie> is added to the container, these properties are used to determine whether a <xref:System.Net.Cookie> already contained in the <xref:System.Net.CookieContainer> should be discarded to make room for the new one. The <xref:System.Net.CookieContainer> keeps track of each addition to ensure that neither the <xref:System.Net.CookieContainer.Capacity%2A> nor the <xref:System.Net.CookieContainer.PerDomainCapacity%2A> limits are exceeded. If one or both are exceeded, then <xref:System.Net.Cookie> instances held by the <xref:System.Net.CookieContainer> are removed. First, any expired <xref:System.Net.Cookie> is removed. If further capacity must be recaptured, then the least-recently used <xref:System.Net.CookieCollection> is purged.
0 commit comments