Unosquare
    Show / Hide Table of Contents

    Class ResponseHeaderCollection

    Contains protocol headers associated with an HTTP response.

    Unlike , that supports a variety of scenarios, this class is only meant to be used for the Headers property of the IHttpResponse interface. Therefore, some header names are restricted and cannot be read or set through an instance of this class.

    The restricted headers are the following:

    Header nameRationale

    Connection

    Content-Encoding

    Content-Length

    Date

    Keep-Alive

    Sec-Web-Socket-Accept

    Sec-Web-Socket-Extensions

    Sec-Web-Socket-Protocol

    Sec-Web-Socket-Version

    Server

    Trailer

    Transfer-Encoding

    These headers are automatically managed by EmbedIO.

    Set-Cookie

    Set-Cookie2

    Cookies are set through the Cookies property.

    Accept

    Accept-Charset

    Accept-Encoding

    Accept-Language

    Accept-Patch

    Accept-Ranges

    Access-Control-Request-Headers

    Access-Control-Request-Method

    Authorization

    Cookie

    Cookie2

    Expect

    From

    Host

    If-Match

    If-Modified-Since

    If-None-Match

    If-Range

    If-Unmodified-Since

    Origin

    Proxy-Authorization

    Range

    Referer

    Sec-Web-Socket-Key

    TE

    Upgrade

    Upgrade-Insecure-Requests

    User-Agent

    These headers are only meant to be included in HTTP requests, not in responses.

    Age

    Proxy-Authentication

    Proxy-Connection

    Via

    These headers are only meant to be sent by proxies, not servers.

    Inheritance
    Object
    ResponseHeaderCollection
    Namespace: EmbedIO.Net
    Syntax
    public sealed class ResponseHeaderCollection : NameValueCollection

    Properties

    AllKeys

    Declaration
    public override string[] AllKeys { get; }
    Property Value
    Type Description
    String[]

    Count

    Declaration
    public override int Count { get; }
    Property Value
    Type Description
    Int32

    Keys

    Declaration
    public override KeysCollection Keys { get; }
    Property Value
    Type Description
    KeysCollection

    Methods

    Add(String, String)

    Declaration
    public override void Add(string name, string value)
    Parameters
    Type Name Description
    String name
    String value

    Clear()

    Declaration
    public override void Clear()

    Get(Int32)

    Declaration
    public override string Get(int index)
    Parameters
    Type Name Description
    Int32 index
    Returns
    Type Description
    String

    Get(String)

    Declaration
    public override string Get(string name)
    Parameters
    Type Name Description
    String name
    Returns
    Type Description
    String

    GetEnumerator()

    Declaration
    public override IEnumerator GetEnumerator()
    Returns
    Type Description
    IEnumerator

    GetHashCode()

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    Int32

    GetKey(Int32)

    Declaration
    public override string GetKey(int index)
    Parameters
    Type Name Description
    Int32 index
    Returns
    Type Description
    String

    GetObjectData(SerializationInfo, StreamingContext)

    Declaration
    public override void GetObjectData(SerializationInfo info, StreamingContext context)
    Parameters
    Type Name Description
    SerializationInfo info
    StreamingContext context

    GetValues(Int32)

    Declaration
    public override string[] GetValues(int index)
    Parameters
    Type Name Description
    Int32 index
    Returns
    Type Description
    String[]

    GetValues(String)

    Declaration
    public override string[] GetValues(string name)
    Parameters
    Type Name Description
    String name
    Returns
    Type Description
    String[]

    IsRestrictedName(String)

    Determines whether a specified header name is restricted, i.e. its value cannot be read or set through a ResponseHeaderCollection.

    See the documentation for ResponseHeaderCollection for a list of restricted header names.

    Declaration
    public static bool IsRestrictedName(string name)
    Parameters
    Type Name Description
    String name

    The header name to test.

    Returns
    Type Description
    Boolean

    true if name is a restricted header name; otherwise, false.

    OnDeserialization(Object)

    Declaration
    public override void OnDeserialization(object sender)
    Parameters
    Type Name Description
    Object sender

    Remove(String)

    Declaration
    public override void Remove(string name)
    Parameters
    Type Name Description
    String name

    Set(String, String)

    Declaration
    public override void Set(string name, string value)
    Parameters
    Type Name Description
    String name
    String value

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    String

    Comments

    Back to top Copyright © 2017-2019 Unosquare