/* * Construct set-cookie header */ internal HttpResponseHeader GetSetCookieHeader(HttpContext context) { StringBuilder s = new StringBuilder(); // cookiename= if (!String.IsNullOrEmpty(_name)) { s.Append(_name); s.Append('='); } // key=value&... if (_multiValue != null) { s.Append(_multiValue.ToString(false)); } else if (_stringValue != null) { s.Append(_stringValue); } // domain if (!String.IsNullOrEmpty(_domain)) { s.Append("; domain="); s.Append(_domain); } // expiration if (_expirationSet && _expires != DateTime.MinValue) { s.Append("; expires="); s.Append(HttpUtility.FormatHttpCookieDateTime(_expires)); } // path if (!String.IsNullOrEmpty(_path)) { s.Append("; path="); s.Append(_path); } // secure if (_secure) { s.Append("; secure"); } // httponly, Note: IE5 on the Mac doesn't support this if (_httpOnly && SupportsHttpOnly(context)) { s.Append("; HttpOnly"); } // return as HttpResponseHeader return(new HttpResponseHeader(HttpWorkerRequest.HeaderSetCookie, s.ToString())); }
/* * Construct set-cookie header */ internal HttpResponseHeader GetSetCookieHeader() { StringBuilder s = new StringBuilder(); // cookiename= if (_name != null && _name.Length > 0) { s.Append(_name); s.Append('='); } // key=value&... if (_multiValue != null) { s.Append(_multiValue.ToString(false)); } else if (_stringValue != null) { s.Append(_stringValue); } // domain if (_domain != null && _domain.Length > 0) { s.Append("; domain="); s.Append(_domain); } // expiration if (_expirationSet && _expires != DateTime.MinValue) { s.Append("; expires="); s.Append(HttpUtility.FormatHttpCookieDateTime(_expires)); } // path if (_path != null && _path.Length > 0) { s.Append("; path="); s.Append(_path); } // secure if (_secure) { s.Append("; secure"); } // return as HttpResponseHeader return(new HttpResponseHeader(HttpWorkerRequest.HeaderSetCookie, s.ToString())); }