HttpResponse.ContentEncoding 屬性

定義

取得或設定輸出資料流的 HTTP 字元集。Gets or sets the HTTP character set of the output stream.

public:
 property System::Text::Encoding ^ ContentEncoding { System::Text::Encoding ^ get(); void set(System::Text::Encoding ^ value); };
public System.Text.Encoding ContentEncoding { get; set; }
member this.ContentEncoding : System.Text.Encoding with get, set
Public Property ContentEncoding As Encoding

屬性值

Encoding 物件,包含目前回應之字元集的相關資訊。A Encoding object that contains information about the character set of the current response.

例外狀況

嘗試將 ContentEncoding 設定為 nullAttempted to set ContentEncoding to null.

範例

下列範例會將人類可讀取的字元集編碼描述寫入輸出資料流程。The following example writes a human-readable description of the character set encoding to the output stream.

Response.Write (Response.ContentEncoding.EncodingName);
    
Response.Write (Response.ContentEncoding.EncodingName)
    

備註

預設 ContentEncoding 可以在全球化專案(ASP.NET 設定架構)一節的 ASP.NET 設定檔中指定。Default ContentEncoding can be specified in an ASP.NET configuration file in the globalization Element (ASP.NET Settings Schema) section. 如果 ContentEncoding 是由用戶端所指定,則會覆寫預設的設定。If ContentEncoding is specified by the client, the default configuration settings are overridden.

適用於