共用方式為


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

標示為安全的上代碼表的組合。

例外狀況

備註

Safe 清單會影響所有 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);  

注意

MarkAsSafe方法必須在 global.asax 檔案的方法中呼叫 Application_Start

適用於