語言

AntiXssEncoder.MarkAsSafe 方法

定義

將指定 Unicode 代碼表中的字元標記為安全。

public:
 static void MarkAsSafe(System::Web::Security::AntiXss::LowerCodeCharts lowerCodeCharts, System::Web::Security::AntiXss::LowerMidCodeCharts lowerMidCodeCharts, System::Web::Security::AntiXss::MidCodeCharts midCodeCharts, System::Web::Security::AntiXss::UpperMidCodeCharts upperMidCodeCharts, System::Web::Security::AntiXss::UpperCodeCharts upperCodeCharts);
public static void MarkAsSafe(System.Web.Security.AntiXss.LowerCodeCharts lowerCodeCharts, System.Web.Security.AntiXss.LowerMidCodeCharts lowerMidCodeCharts, System.Web.Security.AntiXss.MidCodeCharts midCodeCharts, System.Web.Security.AntiXss.UpperMidCodeCharts upperMidCodeCharts, System.Web.Security.AntiXss.UpperCodeCharts upperCodeCharts);
static member MarkAsSafe : System.Web.Security.AntiXss.LowerCodeCharts * System.Web.Security.AntiXss.LowerMidCodeCharts * System.Web.Security.AntiXss.MidCodeCharts * System.Web.Security.AntiXss.UpperMidCodeCharts * System.Web.Security.AntiXss.UpperCodeCharts -> unit
Public Shared Sub MarkAsSafe (lowerCodeCharts As LowerCodeCharts, lowerMidCodeCharts As LowerMidCodeCharts, midCodeCharts As MidCodeCharts, upperMidCodeCharts As UpperMidCodeCharts, upperCodeCharts As UpperCodeCharts)

參數

lowerCodeCharts
LowerCodeCharts

將較低的代碼圖表組合起來標記為安全。

lowerMidCodeCharts
LowerMidCodeCharts

將中下代碼圖表組合起來標記為安全。

midCodeCharts
MidCodeCharts

中間代碼圖表的組合用來標記為安全。

upperMidCodeCharts
UpperMidCodeCharts

上中碼圖表的組合,標記為安全。

upperCodeCharts
UpperCodeCharts

上方代碼圖表的組合來標記為安全。

例外狀況

備註

安全清單影響所有 HTML XML、CSS 及 URL 編碼方法。

除少數例外,Unicode 代碼圖表並不直接對應書寫語言。 若要支援特定語言或一組語言,通常需要將多個程式碼圖標記為安全。

若要在允許英語的同時增加對日語的支援,請使用以下語法:

MarkAsSafe(
            LowerCodeCharts.Default,
            LowerMidCodeCharts.HangulJamo,
            MidCodeCharts.None,
            UpperMidCodeCharts.CjkRadicalsSupplement |
            UpperMidCodeCharts.CjkSymbolsAndPunctuation |
            UpperMidCodeCharts.Hiragana |
            UpperMidCodeCharts.Katakana |
            UpperMidCodeCharts.KatakanaPhoneticExtensions |
            UpperMidCodeCharts.LatinExtendedD |
            UpperMidCodeCharts.CjkUnifiedIdeographs,
            UpperCodeCharts.None);

Note

MarkAsSafe必須在 Application_Start Global.asax 檔案中的方法中呼叫該方法。

適用於