AntiXssEncoder.MarkAsSafe Method (LowerCodeCharts, LowerMidCodeCharts, MidCodeCharts, UpperMidCodeCharts, UpperCodeCharts)
Marks characters from the specified Unicode code charts as safe.
Assembly: System.Web (in System.Web.dll)
Public Shared Sub MarkAsSafe ( lowerCodeCharts As LowerCodeCharts, lowerMidCodeCharts As LowerMidCodeCharts, midCodeCharts As MidCodeCharts, upperMidCodeCharts As UpperMidCodeCharts, upperCodeCharts As UpperCodeCharts )
Parameters
- lowerCodeCharts
-
Type:
System.Web.Security.AntiXss.LowerCodeCharts
The combination of lower code charts to mark as safe.
- lowerMidCodeCharts
-
Type:
System.Web.Security.AntiXss.LowerMidCodeCharts
The combination of lower-middle code charts to mark as safe.
- midCodeCharts
-
Type:
System.Web.Security.AntiXss.MidCodeCharts
The combination of middle code charts to mark as safe.
- upperMidCodeCharts
-
Type:
System.Web.Security.AntiXss.UpperMidCodeCharts
The combination of upper-middle code charts to mark as safe.
- upperCodeCharts
-
Type:
System.Web.Security.AntiXss.UpperCodeCharts
The combination of upper code charts to mark as safe.
| Exception | Condition |
|---|---|
| InvalidOperationException | The AntiXssEncoder.MarkAsSafe(LowerCodeCharts, LowerMidCodeCharts, MidCodeCharts, UpperMidCodeCharts, UpperCodeCharts) method was called outside the Application_Start method in the Global.asax file. |
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. |
Available since 4.5
