public void Add (Cookie cookie)
{
if (cookie == null)
throw new ArgumentNullException ("cookie");
if (cookie.Domain.Length == 0)
#if NET_2_0
throw new ArgumentException ("Cookie domain not set.", "cookie.Domain");
#else
throw new ArgumentException ("cookie.Domain");
#endif
if (cookie.Value.Length > maxCookieSize)
throw new CookieException ("value is larger than MaxCookieSize.");
// .NET's Add (Cookie) is fundamentally broken and does not copy properties
// like Secure, HttpOnly and Expires so we clone the parts that .NET
// does keep before calling AddCookie
Cookie c = new Cookie (cookie.Name, cookie.Value);
c.Path = (cookie.Path.Length == 0) ? "/" : cookie.Path;
c.Domain = cookie.Domain;
c.ExactDomain = cookie.ExactDomain;
c.Version = cookie.Version;
AddCookie (c);
}