public override string ToString()
{
StringBuilder header = new StringBuilder();
bool first = true;
foreach (CookieState cookie in Cookies)
{
first = AppendSegment(header, first, cookie.ToString(), null);
}
if (Expires.HasValue)
{
first = AppendSegment(header, first, ExpiresToken, FormattingUtilities.DateToString(Expires.Value));
}
if (MaxAge.HasValue)
{
first = AppendSegment(header, first, MaxAgeToken, ((int)MaxAge.Value.TotalSeconds).ToString(NumberFormatInfo.InvariantInfo));
}
if (Domain != null)
{
first = AppendSegment(header, first, DomainToken, Domain);
}
if (Path != null)
{
first = AppendSegment(header, first, PathToken, Path);
}
if (Secure)
{
first = AppendSegment(header, first, SecureToken, null);
}
if (HttpOnly)
{
first = AppendSegment(header, first, HttpOnlyToken, null);
}
return header.ToString();
}