HttpListenerResponse.AppendHeader(String, String) HttpListenerResponse.AppendHeader(String, String) HttpListenerResponse.AppendHeader(String, String) HttpListenerResponse.AppendHeader(String, String) Method

定義

附加值至指定的 HTTP 標頭,隨這個回應傳送。Appends a value to the specified HTTP header to be sent with this response.

public:
 void AppendHeader(System::String ^ name, System::String ^ value);
public void AppendHeader (string name, string value);
member this.AppendHeader : string * string -> unit
Public Sub AppendHeader (name As String, value As String)

參數

name
String String String String

要附加 value 之 HTTP 標頭的名稱。The name of the HTTP header to append value to.

value
String String String String

附加到 name 標頭的值。The value to append to the name header.

例外狀況

namenull 或空字串 ("")。name is null or an empty string ("").

-或--or- 您不可指定該特定標頭的值。You are not allowed to specify a value for the specified header.

-或--or- namevalue 包含無效字元。name or value contains invalid characters.

value 的長度大於 65,535 個字元。The length of value is greater than 65,535 characters.

備註

呼叫這個方法相當於呼叫Add Headers屬性所傳回之集合上的方法。Calling this method is equivalent to calling the Add method on the collection returned by the Headers property.

如果中header指定的標頭不存在, 這個方法會將新的標頭Headers插入屬性的集合中。If the header specified in header does not exist, this method inserts a new header into the Headers property's collection. 如果header集合中有, 這個方法會將新增value至現有的值。If header is present in the collection, this method adds value to the existing values. 若要取代現有標頭的值, 請使用AddHeader方法。To replace the value of an existing header, use the AddHeader method.

適用於

另請參閱