ZennoLab Assemblies Documentation
CookieContainer Class
Members  Example 
ZennoLab.CommandCenter Namespace : CookieContainer Class
Represents the container of cookies, that synchronizes with an instance.
Syntax
Remarks
This interface can be used in action OwnCode (C# or PHP) of ProjectMaker.
Example
The following example uses CookieContainer class.
// clear profile cookie container
project.Profile.CookieContainer.Clear();
// creates new cookie container
var cookieContainer = new CookieContainer();
// http request
ZennoPoster.HTTP.Request(InterfacesLibrary.Enums.Http.HttpMethod.GET, "https://zennolab.com", cookieContainer: cookieContainer);
            
// check that the project.Profile.CookieContainer is empty for zennolab.com host
var strings = project.Profile.CookieContainer.GetPairs("zennolab.com");
if (items.Count() != 0) throw new Exception("error");
            
// check that the cookieContainer is NOT empty for zennolab.com host
strings = cookieContainer.GetPairs("zennolab.com");
if (items.Count() == 0) throw new Exception("error");
            
// add the contents of the new container to profile's container
project.Profile.CookieContainer.Add(cookieContainer);
            
// check that the project.Profile.CookieContainer is NOT empty for zennolab.com host
strings = project.Profile.CookieContainer.GetPairs("zennolab.com");
if (items.Count() == 0) throw new Exception("error");
            
// check that the project.Profile.CookieContainer is empty for google.com host
var items = project.Profile.CookieContainer.Get("google.com");
if (items.Count() != 0) throw new Exception("error");
            
// navigate to google.com
instance.ActiveTab.Navigate("http://google.com");
instance.ActiveTab.WaitDownloading();
            
// check that the project.Profile.CookieContainer is NOT empty for google.com host
items = project.Profile.CookieContainer.Get("google.com");
if (items.Count() == 0) throw new Exception("error");
Inheritance Hierarchy

System.Object
   ZennoLab.CommandCenter.CookieContainer

Requirements

Target Platforms: Desktop: Windows XP SP3 and older. Server: Windows Server 2003 and older.

See Also

Reference

CookieContainer Members
ZennoLab.CommandCenter Namespace