Edit

Kongsi melalui


AntiXssEncoder.MarkAsSafe Method

Definition

Marks characters from the specified Unicode code charts as safe.

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)

Parameters

lowerCodeCharts
LowerCodeCharts

The combination of lower code charts to mark as safe.

lowerMidCodeCharts
LowerMidCodeCharts

The combination of lower-middle code charts to mark as safe.

midCodeCharts
MidCodeCharts

The combination of middle code charts to mark as safe.

upperMidCodeCharts
UpperMidCodeCharts

The combination of upper-middle code charts to mark as safe.

upperCodeCharts
UpperCodeCharts

The combination of upper code charts to mark as safe.

Exceptions

The MarkAsSafe(LowerCodeCharts, LowerMidCodeCharts, MidCodeCharts, UpperMidCodeCharts, UpperCodeCharts) method was called outside the Application_Start method in the Global.asax file.

Remarks

The safe list affects all HTML XML, CSS, and URL encoding methods.

With some exceptions, Unicode code charts do not directly correspond to written languages. To add support for a specific language or set of languages often requires marking multiple code charts as safe.

To add support for the Japanese language while continuing to allow English, use the following syntax:

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

Note

The MarkAsSafe method must be called in the Application_Start method in the Global.asax file.

Applies to