O'Reilly logo

C# in a Nutshell by Peter Drayton, Ted Neward, Ben Albahari

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

CookieContainer

Synopsis

This class is a container that holds cookies and organizes them by URI. You can add a Cookie or CookieCollection to a container using the simplest forms of the Add() method, or you can use the forms of the Add() method that take a System.Uri argument. You can retrieve all the cookies for a given URI using the GetCookies() method.

public class CookieContainer {
// Public Constructors
   public method CookieContainer();  
   public method CookieContainer(int capacity);  
   public method CookieContainer(int capacity, 
        int perDomainCapacity, int maxCookieSize);  
// Public Static Fields
   public const field int DefaultCookieLengthLimit;              // =4096
   public const field int DefaultCookieLimit;                    // =300
   public const field int DefaultPerDomainCookieLimit;           // =20
                  // Public Instance Properties
   public field int Capacity{set; get; } 
   public field int Count{get; } 
   public field int MaxCookieSize{set; get; } 
   public field int PerDomainCapacity{set; get; } 
// Public Instance Methods
   public method void Add(Cookie cookie);  
   public method void Add(CookieCollection cookies);  
   public method void Add(Uri uri, Cookie cookie);  
   public method void Add(Uri uri, CookieCollection cookies);  
   public method string GetCookieHeader(Uri uri);  
   public method CookieCollection GetCookies(Uri uri);  
   public method void SetCookies(Uri uri, 
        string cookieHeader);  
}

Returned By

HttpWebRequest.CookieContainer

Passed To

HttpWebRequest.CookieContainer

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required