public void Add(Cookie cookie)
{
Uri uri;
if (cookie == null)
{
throw new ArgumentNullException("cookie");
}
if (cookie.Domain.Length == 0)
{
throw new ArgumentException(SR.GetString("net_emptystringcall"), "cookie.Domain");
}
StringBuilder builder = new StringBuilder();
builder.Append(cookie.Secure ? Uri.UriSchemeHttps : Uri.UriSchemeHttp).Append(Uri.SchemeDelimiter);
if (!cookie.DomainImplicit && (cookie.Domain[0] == '.'))
{
builder.Append("0");
}
builder.Append(cookie.Domain);
if (cookie.PortList != null)
{
builder.Append(":").Append(cookie.PortList[0]);
}
builder.Append(cookie.Path);
if (!Uri.TryCreate(builder.ToString(), UriKind.Absolute, out uri))
{
throw new CookieException(SR.GetString("net_cookie_attribute", new object[] { "Domain", cookie.Domain }));
}
Cookie cookie2 = cookie.Clone();
cookie2.VerifySetDefaults(cookie2.Variant, uri, this.IsLocalDomain(uri.Host), this.m_fqdnMyDomain, true, true);
this.Add(cookie2, true);
}