AntiXssEncoder 類別

定義

將字串編碼以用於 HTML、XML、CSS 和 URL 字串中。

public ref class AntiXssEncoder : System::Web::Util::HttpEncoder
public class AntiXssEncoder : System.Web.Util.HttpEncoder
type AntiXssEncoder = class
    inherit HttpEncoder
Public Class AntiXssEncoder
Inherits HttpEncoder
繼承
AntiXssEncoder

備註

您可以使用 AntiXssEncoder 類別覆寫 HttpEncoder 預設用來編碼和解碼類別方法中的類別,例如 HttpUtilityHttpServerUtilityHttpResponseHeader

在 類別 AntiXssEncoder 中,在安全清單中找不到的所有字元都會由 HtmlAttributeEncodeHtmlEncode 方法編碼。

若要將 類別取代 HttpEncoderAntiXssEncoder 類別,請使用 encoderType Web.config 檔案中 HTTPRuntime 元素的 屬性進行註冊,如下列範例所示:

<httpRuntime encoderType="System.Web.Security.AntiXss.AntiXssEncoder" />  

您可以在 、 HtmlEncodeXmlAttributeEncodeXmlEncode 方法的備註 HtmlAttributeEncode 中找到不同編碼方法的預設安全字元清單。 您可以使用 方法來修改 MarkAsSafe 預設安全清單。

建構函式

AntiXssEncoder()

初始化 AntiXssEncoder 類別的新執行個體。

方法

CssEncode(String)

將指定的字串編碼以用於階層式樣式表 (CSS) 中。

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
HeaderNameValueEncode(String, String, String, String)

將標頭名稱及值編碼為可當做 HTTP 標頭使用的字串。

(繼承來源 HttpEncoder)
HtmlAttributeEncode(String, TextWriter)

將指定的字串編碼並輸出,以用於 HTML 屬性中。

HtmlDecode(String, TextWriter)

將 HTML 編碼字串中的值解碼。

(繼承來源 HttpEncoder)
HtmlEncode(String, Boolean)

將指定的字串編碼以做為 HTML 標記中的文字,並選擇性指定是否要使用 HTML 4.0 具名實體。

HtmlEncode(String, TextWriter)

將指定的字串編碼以做為 HTML 標記中的文字,並使用指定的文字寫入器來輸出字串。

HtmlFormUrlEncode(String)

將指定的字串編碼以用來提交 MIME 類型為 "application/x-www-form-urlencoded" 的表單。

HtmlFormUrlEncode(String, Encoding)

使用指定的字元編碼類型,將指定的字串編碼以用於 MIME 類型為 "application/x-www-form-urlencoded" 的表單提交。

HtmlFormUrlEncode(String, Int32)

使用指定的字碼頁,將指定的字串編碼以用來提交 MIME 類型為 "application/x-www-form-urlencoded" 的表單。

JavaScriptStringEncode(String)

編碼字串。

(繼承來源 HttpEncoder)
MarkAsSafe(LowerCodeCharts, LowerMidCodeCharts, MidCodeCharts, UpperMidCodeCharts, UpperCodeCharts)

將來自指定之 Unicode 字碼表的字元標記為安全。

MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)
UrlEncode(Byte[], Int32, Int32)

從位元組陣列中指定的位移開始將指定數目的位元組編碼,以用於 URL 中

UrlEncode(String)

將指定的字串編碼以用於 URL 中。

UrlEncode(String, Encoding)

使用指定的字元編碼類型,將指定的字串編碼以用於 URL 中。

UrlEncode(String, Int32)

使用指定的字碼頁,將指定的字串編碼以用於 URL 中。

UrlPathEncode(String)

將路徑字串編碼以用於 URL 中。

XmlAttributeEncode(String)

將指定的字串編碼以用於 XML 屬性中。

XmlEncode(String)

將指定的字串編碼以用於 XML 屬性中。

適用於