AntiXssLibrary
Performs encoding of input strings to provide protection against
Cross-Site Scripting (XSS) attacks in various contexts.
The Anti-Cross Site Scripting Library uses the Principle
of Inclusions, sometimes referred to as "safe listing" to
provide protection against Cross-Site Scripting attacks. With
safe listing protection, algorithms look for valid inputs and
automatically treat everything outside that set as a
potential attack. This library can be used as a defense in
depth approach with other mitigation techniques. It is suitable
for applications with high security requirements.
Encodes input strings for use in HTML.
String to be encoded
Encoded string for use in HTML.
This function encodes all but known safe characters. Characters are encoded using &#DECIMAL; notation.
Safe characters include:
- a-zLower case alphabet
- A-ZUpper case alphabet
- 0-9Numbers
- ,Comma
- .Period
- -Dash
- _Underscore
- Space
- Other International character ranges
Example inputs and their related encoded outputs:
- alert('XSS Attack!');alert('XSS Attack!');
- user@contoso.comuser@contoso.com
- Anti-Cross Site Scripting LibraryAnti-Cross Site Scripting Library
Encodes input strings for use in HTML attributes.
String to be encoded
Encoded string for use in HTML attributes.
This function encodes all but known safe characters. Characters are encoded using &#DECIMAL; notation.
Safe characters include:
- a-zLower case alphabet
- A-ZUpper case alphabet
- 0-9Numbers
- ,Comma
- .Period
- -Dash
- _Underscore
- Other International character ranges
Example inputs and encoded outputs:
- alert('XSS Attack!');alert('XSS Attack!');
- user@contoso.comuser@contoso.com
- Anti-Cross Site Scripting LibraryAnti-Cross Site Scripting Library
Encodes input strings for use in universal resource locators (URLs).
String to be encoded
Encoded string for use in URLs.
This function encodes all but known safe characters. Characters are encoded using %SINGLE_BYTE_HEX
and %uDOUBLE_BYTE_HEX notation.
Safe characters include:
- a-zLower case alphabet
- A-ZUpper case alphabet
- 0-9Numbers
- .Period
- -Dash
- _Underscore
- Other International character ranges
Example inputs and encoded outputs:
- alert('XSS Attack!');alert%28%27XSS%20Attack%21%27%29%3b
- user@contoso.comuser%40contoso.com
- Anti-Cross Site Scripting LibraryAnti-Cross%20Site%20Scripting%20Library
Encodes input strings for use in universal resource locators (URLs).
Input string
Codepage number of the input
Encoded string for use in URLs.
This function encodes the output as per the encoding parameter (codepage) passed to it. It encodes
all but known safe characters. Characters are encoded using %SINGLE_BYTE_HEX and %DOUBLE_BYTE_HEX notation.
Safe characters include:
- a-zLower case alphabet
- A-ZUpper case alphabet
- 0-9Numbers
- .Period
- -Dash
- _Underscore
- Other International character ranges
Example inputs and encoded outputs:
- alert('XSSあAttack!');alert%28%27XSS%82%a0Attack%21%27%29%3b
- user@contoso.comuser%40contoso.com
- Anti-Cross Site Scripting LibraryAnti-Cross%20Site%20Scripting%20Library
Encodes input strings for use in XML.
String to be encoded
Encoded string for use in XML.
This function encodes all but known safe characters. Characters are encoded using &#DECIMAL; notation.
Safe characters include:
- a-zLower case alphabet
- A-ZUpper case alphabet
- 0-9Numbers
- ,Comma
- .Period
- -Dash
- _Underscore
- Space
- Other International character ranges
Example inputs and encoded outputs:
- alert('XSS Attack!');alert('XSS Attack!');
- user@contoso.comuser@contoso.com
- Anti-Cross Site Scripting LibraryAnti-Cross Site Scripting Library
Encodes input strings for use in XML attributes.
String to be encoded
Encoded string for use in XML attributes.
This function encodes all but known safe characters. Characters are encoded using &#DECIMAL; notation.
Safe characters include:
- a-zLower case alphabet
- A-ZUpper case alphabet
- 0-9Numbers
- ,Comma
- .Period
- -Dash
- _Underscore
- Other International character ranges
Example inputs and encoded outputs:
- alert('XSS Attack!');alert('XSS Attack!');
- user@contoso.comuser@contoso.com
- Anti-Cross Site Scripting LibraryAnti-Cross Site Scripting Library
Encodes input strings for use in JavaScript.
String to be encoded
Encoded string for use in JavaScript.
This function encodes all but known safe characters. Characters are encoded using \xSINGLE_BYTE_HEX and \uDOUBLE_BYTE_HEX notation.
Safe characters include:
- a-zLower case alphabet
- A-ZUpper case alphabet
- 0-9Numbers
- ,Comma
- .Period
- -Dash
- _Underscore
- Space
- Other International character ranges
Example inputs and encoded outputs:
- alert('XSS Attack!');'alert\x28\x27XSS Attack\x21\x27\x29\x3b'
- user@contoso.com'user\x40contoso.com'
- Anti-Cross Site Scripting Library'Anti-Cross Site Scripting Library'
Encodes input strings for use in JavaScript.
String to be encoded
bool flag to determine whether or not to emit quotes. true = emit quote. false = no quote.
Encoded string for use in JavaScript and does not return the output with en quotes.
This function encodes all but known safe characters. Characters are encoded using \xSINGLE_BYTE_HEX and \uDOUBLE_BYTE_HEX notation.
Safe characters include:
- a-zLower case alphabet
- A-ZUpper case alphabet
- 0-9Numbers
- ,Comma
- .Period
- -Dash
- _Underscore
- Space
- Other International character ranges
Example inputs and encoded outputs:
- alert('XSS Attack!');'alert\x28\x27XSS Attack\x21\x27\x29\x3b'
- user@contoso.com'user\x40contoso.com'
- Anti-Cross Site Scripting Library'Anti-Cross Site Scripting Library'
Encodes input strings for use in Visual Basic Script.
String to be encoded
Encoded string for use in Visual Basic Script.
This function encodes all but known safe characters. Characters are
encoded using &chrw(DECIMAL) notation.
Safe characters include:
-
a-z
Lower case alphabet
-
A-Z
Upper case alphabet
-
0-9
Numbers
-
,
Comma
-
.
Period
-
-
Dash
-
_
Underscore
-
Space
Example inputs and encoded outputs:
-
alert('XSS Attack!');
"alert"&chrw(40)&chrw(39)&"XSS Attack"&chrw(33)&chrw(39)&chrw(41)&chrw(59)
-
user@contoso.com
"user"&chrw(64)&"contoso.com"
-
Anti-Cross Site Scripting Library
"Anti-Cross Site Scripting Library"
Values for the lowest section of the UTF8 Unicode code tables, from U0000 to U0FFF.
No code charts from the lower region of the Unicode tables are safe-listed.
The Basic Latin code table.
http://www.unicode.org/charts/PDF/U0000.pdf
The C1 Controls and Latin-1 Supplement code table.
http://www.unicode.org/charts/PDF/U0080.pdf
The Latin Extended-A code table.
http://www.unicode.org/charts/PDF/U0100.pdf
The Latin Extended-B code table.
http://www.unicode.org/charts/PDF/U0180.pdf
The IPA Extensions code table.
http://www.unicode.org/charts/PDF/U0250.pdf
The Spacing Modifier Letters code table.
http://www.unicode.org/charts/PDF/U02B0.pdf
The Combining Diacritical Marks code table.
http://www.unicode.org/charts/PDF/U0300.pdf
The Greek and Coptic code table.
http://www.unicode.org/charts/PDF/U0370.pdf
The Cyrillic code table.
http://www.unicode.org/charts/PDF/U0400.pdf
The Cyrillic Supplement code table.
http://www.unicode.org/charts/PDF/U0500.pdf
The Armenian code table.
http://www.unicode.org/charts/PDF/U0530.pdf
The Hebrew code table.
http://www.unicode.org/charts/PDF/U0590.pdf
The Arabic code table.
http://www.unicode.org/charts/PDF/U0600.pdf
The Syriac code table.
http://www.unicode.org/charts/PDF/U0700.pdf
The Arabic Supplement code table.
http://www.unicode.org/charts/PDF/U0750.pdf
The Thaana code table.
http://www.unicode.org/charts/PDF/U0780.pdf
The Nko code table.
http://www.unicode.org/charts/PDF/U07C0.pdf
The Samaritan code table.
http://www.unicode.org/charts/PDF/U0800.pdf
The Devanagari code table.
http://www.unicode.org/charts/PDF/U0900.pdf
The Bengali code table.
http://www.unicode.org/charts/PDF/U0980.pdf
The Gurmukhi code table.
http://www.unicode.org/charts/PDF/U0A00.pdf
The Gujarati code table.
http://www.unicode.org/charts/PDF/U0A80.pdf
The Oriya code table.
http://www.unicode.org/charts/PDF/U0B00.pdf
The Tamil code table.
http://www.unicode.org/charts/PDF/U0B80.pdf
The Telugu code table.
http://www.unicode.org/charts/PDF/U0C00.pdf
The Kannada code table.
http://www.unicode.org/charts/PDF/U0C80.pdf
The Malayalam code table.
http://www.unicode.org/charts/PDF/U0D00.pdf
The Sinhala code table.
http://www.unicode.org/charts/PDF/U0D80.pdf
The Thai code table.
http://www.unicode.org/charts/PDF/U0E00.pdf
The Lao code table.
http://www.unicode.org/charts/PDF/U0E80.pdf
The Tibetan code table.
http://www.unicode.org/charts/PDF/U0F00.pdf
The default code tables marked as safe on initialisation.
Values for the lower-mid section of the UTF8 Unicode code tables, from U1000 to U1EFF.
No code charts from the lower-mid region of the Unicode tables are safe-listed.
The Myanmar code table.
http://www.unicode.org/charts/PDF/U1000.pdf
The Georgian code table.
http://www.unicode.org/charts/PDF/U10A0.pdf
The Hangul Jamo code table.
http://www.unicode.org/charts/PDF/U1100.pdf
The Ethiopic code table.
http://www.unicode.org/charts/PDF/U1200.pdf
The Ethiopic supplement code table.
http://www.unicode.org/charts/PDF/U1380.pdf
The Cherokee code table.
http://www.unicode.org/charts/PDF/U13A0.pdf
The Unified Canadian Aboriginal Syllabics code table.
http://www.unicode.org/charts/PDF/U1400.pdf
The Ogham code table.
http://www.unicode.org/charts/PDF/U1680.pdf
The Runic code table.
http://www.unicode.org/charts/PDF/U16A0.pdf
The Tagalog code table.
http://www.unicode.org/charts/PDF/U1700.pdf
The Hanunoo code table.
http://www.unicode.org/charts/PDF/U1720.pdf
The Buhid code table.
http://www.unicode.org/charts/PDF/U1740.pdf
The Tagbanwa code table.
http://www.unicode.org/charts/PDF/U1760.pdf
The Khmer code table.
http://www.unicode.org/charts/PDF/U1780.pdf
The Mongolian code table.
http://www.unicode.org/charts/PDF/U1800.pdf
The Unified Canadian Aboriginal Syllabics Extended code table.
http://www.unicode.org/charts/PDF/U18B0.pdf
The Limbu code table.
http://www.unicode.org/charts/PDF/U1900.pdf
The Tai Le code table.
http://www.unicode.org/charts/PDF/U1950.pdf
The New Tai Lue code table.
http://www.unicode.org/charts/PDF/U1980.pdf
The Khmer Symbols code table
http://www.unicode.org/charts/PDF/U19E0.pdf
The Buginese code table.
http://www.unicode.org/charts/PDF/U1A00.pdf
The Tai Tham code table.
http://www.unicode.org/charts/PDF/U1A20.pdf
The Balinese code table.
http://www.unicode.org/charts/PDF/U1B00.pdf
The Sudanese code table.
http://www.unicode.org/charts/PDF/U1B80.pdf
The Lepcha code table.
http://www.unicode.org/charts/PDF/U1C00.pdf
The Ol Chiki code table.
http://www.unicode.org/charts/PDF/U1C50.pdf
The Vedic Extensions code table.
http://www.unicode.org/charts/PDF/U1CD0.pdf
The Phonetic Extensions code table.
http://www.unicode.org/charts/PDF/U1D00.pdf
The Phonetic Extensions Supplement code table.
http://www.unicode.org/charts/PDF/U1D80.pdf
The Combining Diacritical Marks Supplement code table.
http://www.unicode.org/charts/PDF/U1DC0.pdf
The Latin Extended Additional code table.
http://www.unicode.org/charts/PDF/U1E00.pdf
Values for the middle section of the UTF8 Unicode code tables, from U1F00 to U2DDF
No code charts from the lower region of the Unicode tables are safe-listed.
The Greek Extended code table.
http://www.unicode.org/charts/PDF/U1F00.pdf
The General Punctuation code table.
http://www.unicode.org/charts/PDF/U2000.pdf
The Superscripts and Subscripts code table.
http://www.unicode.org/charts/PDF/U2070.pdf
The Currency Symbols code table.
http://www.unicode.org/charts/PDF/U20A0.pdf
The Combining Diacritical Marks for Symbols code table.
http://www.unicode.org/charts/PDF/U20D0.pdf
The Letterlike Symbols code table.
http://www.unicode.org/charts/PDF/U2100.pdf
The Number Forms code table.
http://www.unicode.org/charts/PDF/U2150.pdf
The Arrows code table.
http://www.unicode.org/charts/PDF/U2190.pdf
The Mathematical Operators code table.
http://www.unicode.org/charts/PDF/U2200.pdf
The Miscellaneous Technical code table.
http://www.unicode.org/charts/PDF/U2300.pdf
The Control Pictures code table.
http://www.unicode.org/charts/PDF/U2400.pdf
The Optical Character Recognition table.
http://www.unicode.org/charts/PDF/U2440.pdf
The Enclosed Alphanumeric code table.
http://www.unicode.org/charts/PDF/U2460.pdf
The Box Drawing code table.
http://www.unicode.org/charts/PDF/U2500.pdf
The Block Elements code table.
http://www.unicode.org/charts/PDF/U2580.pdf
The Geometric Shapes code table.
http://www.unicode.org/charts/PDF/U25A0.pdf
The Miscellaneous Symbols code table.
http://www.unicode.org/charts/PDF/U2600.pdf
The Dingbats code table.
http://www.unicode.org/charts/PDF/U2700.pdf
The Miscellaneous Mathematical Symbols-A code table.
http://www.unicode.org/charts/PDF/U27C0.pdf
The Supplemental Arrows-A code table.
http://www.unicode.org/charts/PDF/U27F0.pdf
The Braille Patterns code table.
http://www.unicode.org/charts/PDF/U2800.pdf
The Supplemental Arrows-B code table.
http://www.unicode.org/charts/PDF/U2900.pdf
The Miscellaneous Mathematical Symbols-B code table.
http://www.unicode.org/charts/PDF/U2980.pdf
The Supplemental Mathematical Operators code table.
http://www.unicode.org/charts/PDF/U2A00.pdf
The Miscellaneous Symbols and Arrows code table.
http://www.unicode.org/charts/PDF/U2B00.pdf
The Glagolitic code table.
http://www.unicode.org/charts/PDF/U2C00.pdf
The Latin Extended-C code table.
http://www.unicode.org/charts/PDF/U2C60.pdf
The Coptic code table.
http://www.unicode.org/charts/PDF/U2C80.pdf
The Georgian Supplement code table.
http://www.unicode.org/charts/PDF/U2D00.pdf
The Tifinagh code table.
http://www.unicode.org/charts/PDF/U2D30.pdf
The Ethiopic Extended code table.
http://www.unicode.org/charts/PDF/U2D80.pdf
Values for the upper middle section of the UTF8 Unicode code tables, from U2DE0 to UA8DF
No code charts from the lower region of the Unicode tables are safe-listed.
The Cyrillic Extended-A code table.
http://www.unicode.org/charts/PDF/U2DE0.pdf
The Supplemental Punctuation code table.
http://www.unicode.org/charts/PDF/U2E00.pdf
The CJK Radicials Supplement code table.
http://www.unicode.org/charts/PDF/U2E80.pdf
The Kangxi Radicials code table.
http://www.unicode.org/charts/PDF/U2F00.pdf
The Ideographic Description Characters code table.
http://www.unicode.org/charts/PDF/U2FF0.pdf
The CJK Symbols and Punctuation code table.
http://www.unicode.org/charts/PDF/U3000.pdf
The Hiragana code table.
http://www.unicode.org/charts/PDF/U3040.pdf
The Katakana code table.
http://www.unicode.org/charts/PDF/U30A0.pdf
The Bopomofo code table.
http://www.unicode.org/charts/PDF/U3100.pdf
The Hangul Compatbility Jamo code table.
http://www.unicode.org/charts/PDF/U3130.pdf
The Kanbun code table.
http://www.unicode.org/charts/PDF/U3190.pdf
The Bopomofu Extended code table.
http://www.unicode.org/charts/PDF/U31A0.pdf
The CJK Strokes code table.
http://www.unicode.org/charts/PDF/U31C0.pdf
The Katakana Phonetic Extensoins code table.
http://www.unicode.org/charts/PDF/U31F0.pdf
The Enclosed CJK Letters and Months code table.
http://www.unicode.org/charts/PDF/U3200.pdf
The CJK Compatibility code table.
http://www.unicode.org/charts/PDF/U3300.pdf
The CJK Unified Ideographs Extension A code table.
http://www.unicode.org/charts/PDF/U3400.pdf
The Yijing Hexagram Symbols code table.
http://www.unicode.org/charts/PDF/U4DC0.pdf
The CJK Unified Ideographs code table.
http://www.unicode.org/charts/PDF/U4E00.pdf
The Yi Syllables code table.
http://www.unicode.org/charts/PDF/UA000.pdf
The Yi Radicals code table.
http://www.unicode.org/charts/PDF/UA490.pdf
The Lisu code table.
http://www.unicode.org/charts/PDF/UA4D0.pdf
The Vai code table.
http://www.unicode.org/charts/PDF/UA500.pdf
The Cyrillic Extended-B code table.
http://www.unicode.org/charts/PDF/UA640.pdf
The Bamum code table.
http://www.unicode.org/charts/PDF/UA6A0.pdf
The Modifier Tone Letters code table.
http://www.unicode.org/charts/PDF/UA700.pdf
The Latin Extended-D code table.
http://www.unicode.org/charts/PDF/UA720.pdf
The Syloti Nagri code table.
http://www.unicode.org/charts/PDF/UA800.pdf
The Common Indic Number Forms code table.
http://www.unicode.org/charts/PDF/UA830.pdf
The Phags-pa code table.
http://www.unicode.org/charts/PDF/UA840.pdf
The Saurashtra code table.
http://www.unicode.org/charts/PDF/UA880.pdf
Values for the upper section of the UTF8 Unicode code tables, from UA8E0 to UFFFD
No code charts from the upper region of the Unicode tables are safe-listed.
The Devanagari Extended code table.
http://www.unicode.org/charts/PDF/UA8E0.pdf
The Kayah Li code table.
http://www.unicode.org/charts/PDF/UA900.pdf
The Rejang code table.
http://www.unicode.org/charts/PDF/UA930.pdf
The Hangul Jamo Extended-A code table.
http://www.unicode.org/charts/PDF/UA960.pdf
The Javanese code table.
http://www.unicode.org/charts/PDF/UA980.pdf
The Cham code table.
http://www.unicode.org/charts/PDF/UAA00.pdf
The Myanmar Extended-A code table.
http://www.unicode.org/charts/PDF/UAA60.pdf
The Tai Viet code table.
http://www.unicode.org/charts/PDF/UAA80.pdf
The Meetei Mayek code table.
http://www.unicode.org/charts/PDF/UABC0.pdf
The Hangul Syllables code table.
http://www.unicode.org/charts/PDF/UAC00.pdf
The Hangul Jamo Extended-B code table.
http://www.unicode.org/charts/PDF/UD7B0.pdf
The CJK Compatibility Ideographs code table.
http://www.unicode.org/charts/PDF/UF900.pdf
The Alphabetic Presentation Forms code table.
http://www.unicode.org/charts/PDF/UFB00.pdf
The Arabic Presentation Forms-A code table.
http://www.unicode.org/charts/PDF/UFB50.pdf
The Variation Selectors code table.
http://www.unicode.org/charts/PDF/UFE00.pdf
The Vertical Forms code table.
http://www.unicode.org/charts/PDF/UFE10.pdf
The Combining Half Marks code table.
http://www.unicode.org/charts/PDF/UFE20.pdf
The CJK Compatibility Forms code table.
http://www.unicode.org/charts/PDF/UFE30.pdf
The Small Form Variants code table.
http://www.unicode.org/charts/PDF/UFE50.pdf
The Arabic Presentation Forms-B code table.
http://www.unicode.org/charts/PDF/UFE70.pdf
The half width and full width Forms code table.
http://www.unicode.org/charts/PDF/UFF00.pdf
The Specials code table.
http://www.unicode.org/charts/PDF/UFFF0.pdf
Helper functions to simplify range/safe enumerations.
Generates a range of numbers starting at , ending at and using any exclusions specified in the .
The starting number.
The finishing number.
A function returning true for any number to be excluded.
An enumerable collection of integers starting at and ending at , with any exclusions specified.
Generates a range of numbers with no exclusions.
The starting number.
The finishing number.
An enumerable collection of integers starting at and ending at .
Provides safe character positions for the lower section of the UTF code tables.
Determines if the specified flag is set.
The value to check.
The flag to check for.
true if the flag is set, otherwise false.
Provides the safe characters for the Basic Latin code table.
The safe characters for the code table.
Provides the safe characters for the Latin 1 Supplement code table.
The safe characters for the code table.
Provides the safe characters for the Latin Extended A code table.
The safe characters for the code table.
Provides the safe characters for the Latin Extended B code table.
The safe characters for the code table.
Provides the safe characters for the IPA Extensions code table.
The safe characters for the code table.
Provides the safe characters for the Spacing Modifiers code table.
The safe characters for the code table.
Provides the safe characters for the Combining Diacritical Marks code table.
The safe characters for the code table.
Provides the safe characters for the Greek and Coptic code table.
The safe characters for the code table.
Provides the safe characters for the Cyrillic code table.
The safe characters for the code table.
Provides the safe characters for the Cyrillic Supplement code table.
The safe characters for the code table.
Provides the safe characters for the Armenian code table.
The safe characters for the code table.
Provides the safe characters for the Hebrew code table.
The safe characters for the code table.
Provides the safe characters for the Arabic code table.
The safe characters for the code table.
Provides the safe characters for the Syriac code table.
The safe characters for the code table.
Provides the safe characters for the Arabic Supplement code table.
The safe characters for the code table.
Provides the safe characters for the Thaana code table.
The safe characters for the code table.
Provides the safe characters for the Nko code table.
The safe characters for the code table.
Provides the safe characters for the Samaritan code table.
The safe characters for the code table.
Provides the safe characters for the Devenagari code table.
The safe characters for the code table.
Provides the safe characters for the Bengali code table.
The safe characters for the code table.
Provides the safe characters for the Gurmukhi code table.
The safe characters for the code table.
Provides the safe characters for the Gujarati code table.
The safe characters for the code table.
Provides the safe characters for the Oriya code table.
The safe characters for the code table.
Provides the safe characters for the Tamil code table.
The safe characters for the code table.
Provides the safe characters for the Telugu code table.
The safe characters for the code table.
Provides the safe characters for the Kannada code table.
The safe characters for the code table.
Provides the safe characters for the Malayalam code table.
The safe characters for the code table.
Provides the safe characters for the Sinhala code table.
The safe characters for the code table.
Provides the safe characters for the Thai code table.
The safe characters for the code table.
Provides the safe characters for the Lao code table.
The safe characters for the code table.
Provides the safe characters for the Tibetan code table.
The safe characters for the code table.
Provides safe character positions for the lower middle section of the UTF code tables.
Determines if the specified flag is set.
The value to check.
The flag to check for.
true if the flag is set, otherwise false.
Provides the safe characters for the Myanmar code table.
The safe characters for the code table.
Provides the safe characters for the Georgian code table.
The safe characters for the code table.
Provides the safe characters for the Hangul Jamo code table.
The safe characters for the code table.
Provides the safe characters for the Ethiopic code table.
The safe characters for the code table.
Provides the safe characters for the Ethiopic Supplement code table.
The safe characters for the code table.
Provides the safe characters for the Cherokee code table.
The safe characters for the code table.
Provides the safe characters for the Unified Canadian Aboriginal Syllabic code table.
The safe characters for the code table.
Provides the safe characters for the Ogham code table.
The safe characters for the code table.
Provides the safe characters for the Runic code table.
The safe characters for the code table.
Provides the safe characters for the Tagalog code table.
The safe characters for the code table.
Provides the safe characters for the Hanunoo code table.
The safe characters for the code table.
Provides the safe characters for the Buhid code table.
The safe characters for the code table.
Provides the safe characters for the Tagbanwa code table.
The safe characters for the code table.
Provides the safe characters for the Khmer code table.
The safe characters for the code table.
Provides the safe characters for the Mongolian code table.
The safe characters for the code table.
Provides the safe characters for the Unified Canadian Aboriginal Syllabic Extended code table.
The safe characters for the code table.
Provides the safe characters for the Limbu code table.
The safe characters for the code table.
Provides the safe characters for the Tai Le code table.
The safe characters for the code table.
Provides the safe characters for the New Tai Lue code table.
The safe characters for the code table.
Provides the safe characters for the Khmer Symbols code table.
The safe characters for the code table.
Provides the safe characters for the Khmer Symbols code table.
The safe characters for the code table.
Provides the safe characters for the Tai Tham code table.
The safe characters for the code table.
Provides the safe characters for the Balinese code table.
The safe characters for the code table.
Provides the safe characters for the Sudanese code table.
The safe characters for the code table.
Provides the safe characters for the Lepcha code table.
The safe characters for the code table.
Provides the safe characters for the Ol Chiki code table.
The safe characters for the code table.
Provides the safe characters for the Vedic Extensions code table.
The safe characters for the code table.
Provides the safe characters for the Phonetic Extensions code table.
The safe characters for the code table.
Provides the safe characters for the Phonetic Extensions Supplement code table.
The safe characters for the code table.
Provides the safe characters for the Combining Diacritical Marks Supplement code table.
The safe characters for the code table.
Provides the safe characters for the Latin Extended Addition code table.
The safe characters for the code table.
Provides safe character positions for the middle section of the UTF code tables.
Determines if the specified flag is set.
The value to check.
The flag to check for.
true if the flag is set, otherwise false.
Provides the safe characters for the Greek Extended code table.
The safe characters for the code table.
Provides the safe characters for the General Punctuation code table.
The safe characters for the code table.
Provides the safe characters for the Superscripts and subscripts code table.
The safe characters for the code table.
Provides the safe characters for the Currency Symbols code table.
The safe characters for the code table.
Provides the safe characters for the Combining Diacritrical Marks for Symbols code table.
The safe characters for the code table.
Provides the safe characters for the Letterlike Symbols code table.
The safe characters for the code table.
Provides the safe characters for the Number Forms code table.
The safe characters for the code table.
Provides the safe characters for the Arrows code table.
The safe characters for the code table.
Provides the safe characters for the Mathematical Operators code table.
The safe characters for the code table.
Provides the safe characters for the Miscellaneous Technical code table.
The safe characters for the code table.
Provides the safe characters for the Control Pictures code table.
The safe characters for the code table.
Provides the safe characters for the OCR code table.
The safe characters for the code table.
Provides the safe characters for the Enclosed Alphanumerics code table.
The safe characters for the code table.
Provides the safe characters for the Box Drawing code table.
The safe characters for the code table.
Provides the safe characters for the Block Elements code table.
The safe characters for the code table.
Provides the safe characters for the Geometric Shapes code table.
The safe characters for the code table.
Provides the safe characters for the Miscellaneous Symbols code table.
The safe characters for the code table.
Provides the safe characters for the Dingbats code table.
The safe characters for the code table.
Provides the safe characters for the Miscellaneous Mathematical Symbols A code table.
The safe characters for the code table.
Provides the safe characters for the Supplemental Arrows A code table.
The safe characters for the code table.
Provides the safe characters for the Braille Patterns code table.
The safe characters for the code table.
Provides the safe characters for the Supplemental Arrows B code table.
The safe characters for the code table.
Provides the safe characters for the Miscellaneous Mathematical Symbols B code table.
The safe characters for the code table.
Provides the safe characters for the Supplemental Mathematical Operators code table.
The safe characters for the code table.
Provides the safe characters for the Miscellaneous Symbols and Arrows code table.
The safe characters for the code table.
Provides the safe characters for the Glagolitic code table.
The safe characters for the code table.
Provides the safe characters for the Latin Extended C code table.
The safe characters for the code table.
Provides the safe characters for the Coptic table.
The safe characters for the code table.
Provides the safe characters for the Georgian Supplement code table.
The safe characters for the code table.
Provides the safe characters for the Tifinagh code table.
The safe characters for the code table.
Provides the safe characters for the Ethiopic Extended code table.
The safe characters for the code table.
Provides safe character positions for the upper section of the UTF code tables.
Determines if the specified flag is set.
The value to check.
The flag to check for.
true if the flag is set, otherwise false.
Provides the safe characters for the Devanagari Extended code table.
The safe characters for the code table.
Provides the safe characters for the Kayah Li code table.
The safe characters for the code table.
Provides the safe characters for the Rejang code table.
The safe characters for the code table.
Provides the safe characters for the Hangul Jamo Extended A code table.
The safe characters for the code table.
Provides the safe characters for the Javanese code table.
The safe characters for the code table.
Provides the safe characters for the Cham code table.
The safe characters for the code table.
Provides the safe characters for the Myanmar Extended A code table.
The safe characters for the code table.
Provides the safe characters for the Myanmar Extended A code table.
The safe characters for the code table.
Provides the safe characters for the Meetei Mayek code table.
The safe characters for the code table.
Provides the safe characters for the Hangul Syllables code table.
The safe characters for the code table.
Provides the safe characters for the Hangul Jamo Extended B code table.
The safe characters for the code table.
Provides the safe characters for the CJK Compatibility Ideographs code table.
The safe characters for the code table.
Provides the safe characters for the Alphabetic Presentation Forms code table.
The safe characters for the code table.
Provides the safe characters for the Arabic Presentation Forms A code table.
The safe characters for the code table.
Provides the safe characters for the Variation Selectors code table.
The safe characters for the code table.
Provides the safe characters for the Vertical Forms code table.
The safe characters for the code table.
Provides the safe characters for the Combining Half Marks code table.
The safe characters for the code table.
Provides the safe characters for the CJK Compatibility Forms code table.
The safe characters for the code table.
Provides the safe characters for the Small Form Variants code table.
The safe characters for the code table.
Provides the safe characters for the Arabic Presentation Forms B code table.
The safe characters for the code table.
Provides the safe characters for the Half Width and Full Width Forms code table.
The safe characters for the code table.
Provides the safe characters for the Specials code table.
The safe characters for the code table.
Provides safe character positions for the upper middle section of the UTF code tables.
Determines if the specified flag is set.
The value to check.
The flag to check for.
true if the flag is set, otherwise false.
Provides the safe characters for the Cyrillic Extended A code table.
The safe characters for the code table.
Provides the safe characters for the Cyrillic Extended A code table.
The safe characters for the code table.
Provides the safe characters for the CJK Radicals Supplement code table.
The safe characters for the code table.
Provides the safe characters for the Kangxi Radicals code table.
The safe characters for the code table.
Provides the safe characters for the Ideographic Description Characters code table.
The safe characters for the code table.
Provides the safe characters for the CJK Symbols and Punctuation code table.
The safe characters for the code table.
Provides the safe characters for the Hiragana code table.
The safe characters for the code table.
Provides the safe characters for the Hiragana code table.
The safe characters for the code table.
Provides the safe characters for the Bopomofo code table.
The safe characters for the code table.
Provides the safe characters for the Hangul Compatibility Jamo code table.
The safe characters for the code table.
Provides the safe characters for the Kanbun code table.
The safe characters for the code table.
Provides the safe characters for the Bopomofo Extended code table.
The safe characters for the code table.
Provides the safe characters for the CJK Strokes code table.
The safe characters for the code table.
Provides the safe characters for the Katakana Phonetic Extensions code table.
The safe characters for the code table.
Provides the safe characters for the Enclosed CJK Letters and Months code table.
The safe characters for the code table.
Provides the safe characters for the CJK Compatibility code table.
The safe characters for the code table.
Provides the safe characters for the CJK Unified Ideographs Extension A code table.
The safe characters for the code table.
Provides the safe characters for the Yijing Hexagram Symbols code table.
The safe characters for the code table.
Provides the safe characters for the CJK Unified Ideographs code table.
The safe characters for the code table.
Provides the safe characters for the Yi Syllables code table.
The safe characters for the code table.
Provides the safe characters for the Yi Radicals code table.
The safe characters for the code table.
Provides the safe characters for the Lisu code table.
The safe characters for the code table.
Provides the safe characters for the Vai code table.
The safe characters for the code table.
Provides the safe characters for the Cyrillic Extended B code table.
The safe characters for the code table.
Provides the safe characters for the Bamum code table.
The safe characters for the code table.
Provides the safe characters for the Modifier Tone Letters code table.
The safe characters for the code table.
Provides the safe characters for the Latin Extended D code table.
The safe characters for the code table.
Provides the safe characters for the Syloti Nagri code table.
The safe characters for the code table.
Provides the safe characters for the Common Indic Number Forms code table.
The safe characters for the code table.
Provides the safe characters for the Phags-pa code table.
The safe characters for the code table.
Provides the safe characters for the Saurashtra code table.
The safe characters for the code table.
Provides CSS Encoding methods.
The values to output for each character.
Encodes according to the CSS encoding rules.
The string to encode.
The encoded string.
Initializes the CSS safe list.
The CSS safe list.
Provides the safe characters for CS encoding.
The safe characters for CSS encoding.
See http://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet
Performs encoding of input strings to provide protection against
Cross-Site Scripting (XSS) attacks and LDAP injection attacks in
various contexts.
This encoding library uses the Principle of Inclusions,
sometimes referred to as "safe-listing" to provide protection
against injection attacks. With safe-listing protection,
algorithms look for valid inputs and automatically treat
everything outside that set as a potential attack. This library
can be used as a defense in depth approach with other mitigation
techniques. It is suitable for applications with high security
requirements.
Empty string for Visual Basic Script context
Empty string for Java Script context
Initializes character Html encoding array
Encodes input strings for use as a value in Lightweight Directory Access Protocol (LDAP) filter queries.
String to be encoded.
Encoded string for use as a value in LDAP filter queries.
This method encodes all but known safe characters defined in the safe list.
RFC 4515 defines the format in which special characters need to be
escaped to be used inside a search filter. Special characters need to be
encoded in \XX format where XX is the hex representation of the character.
The following examples illustrate the use of the escaping mechanism.
- Parens R Us (for all your parenthetical needs)Parens R Us \28for all your parenthetical needs\29
- *\2A
- C:\MyFileC:\5CMyFile
- NULLNULLNULLEOT (binary)\00\00\00\04
- LučićLu\C4\8Di\C4\87
Encodes input strings for use as a value in Lightweight Directory Access Protocol (LDAP) DNs.
String to be encoded.
Encoded string for use as a value in LDAP DNs.
This method encodes all but known safe characters defined in the safe list.
RFC 2253 defines the format in which special characters need to be
escaped to be used inside a search filter. Special characters need to be
encoded in #XX format where XX is the hex representation of the character or a
specific \ escape format.
The following examples illustrate the use of the escaping mechanism.
- , + \ " \ < >\, \+ \" \\ \< \>
- hello\ hello
- hello hello \
- #hello\#hello
- LučićLu#C4#8Di#C4#87
Encodes input strings for use as a value in Lightweight Directory Access Protocol (LDAP) DNs.
String to be encoded.
Value indicating whether the special case rules for encoding of spaces and octothorpes at the start of a string are used.
Value indicating whether the special case for encoding of final character spaces is used.
Encoded string for use as a value in LDAP DNs.\
This method encodes all but known safe characters defined in the safe list.
RFC 2253 defines the format in which special characters need to be
escaped to be used inside a search filter. Special characters need to be
encoded in #XX format where XX is the hex representation of the character or a
specific \ escape format.
The following examples illustrate the use of the escaping mechanism.
- , + \ " \ < >\, \+ \" \\ \< \>
- hello\ hello
- hello hello\
- #hello\#hello
- LučićLu#C4#8Di#C4#87
If useInitialCharacterRules is set to false then escaping of the initial space or octothorpe characters is not performed;
- , + \ " \ < >\, \+ \" \\ \< \>
- hello hello
- hello hello\
- #hello#hello
- LučićLu#C4#8Di#C4#87
If useFinalCharacterRule is set to false then escaping of a space at the end of a string is not performed;
- , + \ " \ < >\, \+ \" \\ \< \>
- hello hello
- hello hello
- #hello#hello
- LučićLu#C4#8Di#C4#87
Encodes input strings to be used as a value in Lightweight Directory Access Protocol (LDAP) search queries.
String to be encoded.
Encoded string for use in LDAP search queries.
This method encodes all but known safe characters defined in the safe list.
RFC 4515 defines the format in which special characters need to be
escaped to be used inside a search filter. Special characters need to be
encoded in \XX format where XX is the hex representation of the character.
The following examples illustrate the use of the escaping mechanism.
- Parens R Us (for all your parenthetical needs)Parens R Us \28for all your parenthetical needs\29
- *\2A
- C:\MyFileC:\5CMyFile
- NULLNULLNULLEOT (binary)\00\00\00\04
- LučićLu\C4\8Di\C4\87
Encodes the specified string for use in Cascading Style Sheet (CSS) attributes. The return value from this function is expected to be
used in building an attribute string. CSS string attributes should be quoted values.
String to be encoded.
Encoded string for use in CSS element values.
This method encodes all characters except those that are in the safe list.
The following table lists the default safe characters.
Unicode Code ChartCharacters(s)Description
- C0 Controls and Basic LatinA-ZUppercase alphabetic letters>
- C0 Controls and Basic Latina-zLowercase alphabetic letters>
- C0 Controls and Basic Latin0-9Numbers>
The CSS character escape sequence consists of a backslash character (\) followed by up to six hexadecimal digits that represent a character code from the ISO 10646 standard.
(The ISO 10646 standard is effectively equivalent to Unicode.) Any character other than a hexadecimal digit terminates the escape sequence. If a character that follows the
escape sequence is also a valid hexadecimal digit, it must either include six digits in the escape sequence or use a whitespace character to terminate the escape sequence.
For example, \000020 denotes a space.
Encodes input strings for use in HTML.
String to be encoded.
Encoded string for use in HTML.
All characters not safe listed are encoded to their Unicode decimal value, using &#DECIMAL; notation.
The default safe characters include:
- a-zLower case alphabet
- A-ZUpper case alphabet
- 0-9Numbers
- ,Comma
- .Period
- -Dash
- _Underscore
- 'Apostrophe
- Space
The safe list may be adjusted using .
Example inputs and their related encoded outputs:
- <script>alert('XSS Attack!');</script><script>alert('XSS Attack!');</script>
- user@contoso.comuser@contoso.com
- Anti-Cross Site Scripting LibraryAnti-Cross Site Scripting Library
- "Anti-Cross Site Scripting Library""e;Anti-Cross Site Scripting Library"e;
Encodes input strings for use in HTML.
String to be encoded.
Value indicating if the HTML 4.0 named entities should be used.
Encoded string for use in HTML.
All characters not safe listed are encoded to their Unicode decimal value, using &#DECIMAL; notation.
If you choose to use named entities then if a character is an HTML4.0 named entity the named entity will be used.
The default safe characters include:
- a-zLower case alphabet
- A-ZUpper case alphabet
- 0-9Numbers
- ,Comma
- .Period
- -Dash
- _Underscore
- 'Apostrophe
- Space
The safe list may be adjusted using .
Example inputs and their related encoded outputs:
- <script>alert('XSS Attack!');</script><script>alert('XSS Attack!');</script>
- user@contoso.comuser@contoso.com
- Anti-Cross Site Scripting LibraryAnti-Cross Site Scripting Library
- "Anti-Cross Site Scripting Library""e;Anti-Cross Site Scripting Library"e;
Encodes an input string for use in an HTML attribute.
String to be encoded.
The input string encoded for use in an HTML attribute.
This function encodes all but known safe characters. Characters are encoded using &#DECIMAL; notation.
Safe characters include:
- a-zLower case alphabet
- A-ZUpper case alphabet
- 0-9Numbers
- ,Comma
- .Period
- -Dash
- _Underscore
The safe list may be adjusted using .
Example inputs and encoded outputs:
- alert('XSS Attack!');alert('XSS Attack!');
- user@contoso.comuser@contoso.com
- Anti-Cross Site Scripting LibraryAnti-Cross Site Scripting Library
Encodes input strings for use in universal resource locators (URLs).
String to be encoded.
Encoded string for use in URLs.
This function encodes all but known safe characters. Characters are encoded using %SINGLE_BYTE_HEX
and %DOUBLE_BYTE_HEX notation.
Safe characters include:
- a-zLower case alphabet
- A-ZUpper case alphabet
- 0-9Numbers
- .Period
- -Dash
- _Underscore
- ~Tilde
Example inputs and encoded outputs:
- alert('XSS Attack!');alert%28%27XSS%20Attack%21%27%29%3b
- user@contoso.comuser%40contoso.com
- Anti-Cross Site Scripting LibraryAnti-Cross%20Site%20Scripting%20Library
Encodes input strings for use in application/x-www-form-urlencoded form submissions.
String to be encoded.
Encoded string for use in URLs.
This function encodes all but known safe characters. Characters are encoded using %SINGLE_BYTE_HEX
and %DOUBLE_BYTE_HEX notation.
Safe characters include:
- a-zLower case alphabet
- A-ZUpper case alphabet
- 0-9Numbers
- .Period
- -Dash
- _Underscore
- ~Tilde
Example inputs and encoded outputs:
- alert('XSS Attack!');alert%28%27XSS+Attack%21%27%29%3b
- user@contoso.comuser%40contoso.com
- Anti-Cross Site Scripting LibraryAnti-Cross+Site+Scripting+Library
Encodes input strings for use in universal resource locators (URLs).
String to be encoded.
Codepage number of the input.
Encoded string for use in URLs.
This function encodes the output as per the encoding parameter (codepage) passed to it. It encodes
all but known safe characters. Characters are encoded using %SINGLE_BYTE_HEX and %DOUBLE_BYTE_HEX notation.
Safe characters include:
- a-zLower case alphabet
- A-ZUpper case alphabet
- 0-9Numbers
- .Period
- -Dash
- _Underscore
- ~Tilde
Example inputs and encoded outputs:
- alert('XSSあAttack!');alert%28%27XSS%82%a0Attack%21%27%29%3b
- user@contoso.comuser%40contoso.com
- Anti-Cross Site Scripting LibraryAnti-Cross%20Site%20Scripting%20Library
Encodes input strings for use in application/x-www-form-urlencoded form submissions.
String to be encoded.
Codepage number of the input.
Encoded string for use in URLs.
This function encodes the output as per the encoding parameter (codepage) passed to it. It encodes
all but known safe characters. Characters are encoded using %SINGLE_BYTE_HEX and %DOUBLE_BYTE_HEX notation.
Safe characters include:
- a-zLower case alphabet
- A-ZUpper case alphabet
- 0-9Numbers
- .Period
- -Dash
- _Underscore
- ~Tilde
Example inputs and encoded outputs:
- alert('XSSあAttack!');alert%28%27XSS%82%a0Attack%21%27%29%3b
- user@contoso.comuser%40contoso.com
- Anti-Cross Site Scripting LibraryAnti-Cross+Site+Scripting+Library
Encodes input strings for use in universal resource locators (URLs).
String to be encoded.
Input encoding type.
Encoded string for use in URLs.
This function encodes the output as per the encoding parameter (codepage) passed to it. It encodes
all but known safe characters. Characters are encoded using %SINGLE_BYTE_HEX and %DOUBLE_BYTE_HEX notation.
If the inputEncoding is null then UTF-8 is assumed by default.
Safe characters include:
- a-zLower case alphabet
- A-ZUpper case alphabet
- 0-9Numbers
- .Period
- -Dash
- _Underscore
- ~Tilde
Example inputs and encoded outputs:
- alert('XSSあAttack!');alert%28%27XSS%82%a0Attack%21%27%29%3b
- user@contoso.comuser%40contoso.com
- Anti-Cross Site Scripting LibraryAnti-Cross%20Site%20Scripting%20Library
Encodes input strings for use in application/x-www-form-urlencoded form submissions.
String to be encoded.
Input encoding type.
Encoded string for use in URLs.
This function encodes the output as per the encoding parameter (codepage) passed to it. It encodes
all but known safe characters. Characters are encoded using %SINGLE_BYTE_HEX and %DOUBLE_BYTE_HEX notation.
If the inputEncoding is null then UTF-8 is assumed by default.
Safe characters include:
- a-zLower case alphabet
- A-ZUpper case alphabet
- 0-9Numbers
- .Period
- -Dash
- _Underscore
- ~Tilde
Example inputs and encoded outputs:
- alert('XSSあAttack!');alert%28%27XSS%82%a0Attack%21%27%29%3b
- user@contoso.comuser%40contoso.com
- Anti-Cross Site Scripting LibraryAnti-Cross+Site+Scripting+Library
URL-encodes the path section of a URL string and returns the encoded string.
The text to URL path encode
The URL path encoded text.
Encodes input strings for use in XML.
String to be encoded.
Encoded string for use in XML.
This function encodes all but known safe characters. Characters are encoded using &#DECIMAL; notation.
Safe characters include:
- a-zLower case alphabet
- A-ZUpper case alphabet
- 0-9Numbers
- ,Comma
- .Period
- -Dash
- _Underscore
- Space
The safe list may be adjusted using .
Example inputs and encoded outputs:
- alert('XSS Attack!');alert('XSS Attack!');
- user@contoso.comuser@contoso.com
- Anti-Cross Site Scripting LibraryAnti-Cross Site Scripting Library
Encodes input strings for use in XML attributes.
String to be encoded.
Encoded string for use in XML attributes.
This function encodes all but known safe characters. Characters are encoded using &#DECIMAL; notation.
Safe characters include:
- a-zLower case alphabet
- A-ZUpper case alphabet
- 0-9Numbers
- ,Comma
- .Period
- -Dash
- _Underscore
The safe list may be adjusted using .
Example inputs and encoded outputs:
- alert('XSS Attack!');alert('XSS Attack!&apos);
- user@contoso.comuser@contoso.com
- Anti-Cross Site Scripting LibraryAnti-Cross Site Scripting Library
Encodes input strings for use in JavaScript.
String to be encoded.
Encoded string for use in JavaScript.
This function encodes all but known safe characters. Characters are encoded using \xSINGLE_BYTE_HEX and \uDOUBLE_BYTE_HEX notation.
Safe characters include:
- a-zLower case alphabet
- A-ZUpper case alphabet
- 0-9Numbers
- ,Comma
- .Period
- -Dash
- _Underscore
- Space
- Other International character ranges
Example inputs and encoded outputs:
- alert('XSS Attack!');'alert\x28\x27XSS Attack\x21\x27\x29\x3b'
- user@contoso.com'user\x40contoso.com'
- Anti-Cross Site Scripting Library'Anti-Cross Site Scripting Library'
Encodes input strings for use in JavaScript.
String to be encoded.
value indicating whether or not to emit quotes. true = emit quote. false = no quote.
Encoded string for use in JavaScript and does not return the output with en quotes.
This function encodes all but known safe characters. Characters are encoded using \xSINGLE_BYTE_HEX and \uDOUBLE_BYTE_HEX notation.
Safe characters include:
- a-zLower case alphabet
- A-ZUpper case alphabet
- 0-9Numbers
- ,Comma
- .Period
- -Dash
- _Underscore
- Space
- Other International character ranges
Example inputs and encoded outputs:
- alert('XSS Attack!');'alert\x28\x27XSS Attack\x21\x27\x29\x3b'
- user@contoso.com'user\x40contoso.com'
- Anti-Cross Site Scripting Library'Anti-Cross Site Scripting Library'
Encodes input strings for use in Visual Basic Script.
String to be encoded.
Encoded string for use in Visual Basic Script.
This function encodes all but known safe characters. Characters are
encoded using &chrw(DECIMAL) notation.
Safe characters include:
- a-zLower case alphabet
- A-ZUpper case alphabet
- 0-9Numbers
- ,Comma
- .Period
- -Dash
- _Underscore
- Space
Example inputs and encoded outputs:
- alert('XSS Attack!');"alert"&chrw(40)&chrw(39)&"XSS Attack"&chrw(33)&chrw(39)&chrw(41)&chrw(59)
- user@contoso.com"user"&chrw(64)&"contoso.com"
- Anti-Cross Site Scripting Library"Anti-Cross Site Scripting Library"
Initializes the safe list.
A two dimensional character array containing characters and their encoded values.
Provides helper methods common to all Anti-XSS encoders.
Gets an appropriately-sized StringBuilder for the output of an encoding routine.
The length (in characters) of the input string.
The worst-case ratio of output characters per input character.
A StringBuilder appropriately-sized to hold the output string.
The type of space encoding to use.
Encode spaces for use in query strings
Encode spaces for use in form data
Provides Html Parameter Encoding methods.
The value to use when encoding a space for query strings.
The value to use when encoding a space for form data.
The values to output for each character during parameter encoding.
The path character safe list.
Encodes a string for query string encoding and returns the encoded string.
The text to URL-encode.
The encoding for the text parameter.
The URL-encoded text.
URL encoding ensures that all browsers will correctly transmit text in URL strings.
Characters such as a question mark (?), ampersand (&), slash mark (/), and spaces might be truncated or corrupted by some browsers.
As a result, these characters must be encoded in <a> tags or in query strings where the strings can be re-sent by a browser
in a request string.
Thrown if the encoding is null.
Encodes a string for form URL encoding and returns the encoded string.
The text to URL-encode.
The encoding for the text parameter.
The URL-encoded text.
URL encoding ensures that all browsers will correctly transmit text in URL strings.
Characters such as a question mark (?), ampersand (&), slash mark (/), and spaces might be truncated or corrupted by some browsers.
As a result, these characters must be encoded in <a> tags or in query strings where the strings can be re-sent by a browser
in a request string.
Thrown if the encoding is null.
Encodes a string as a URL
The string to encode.
The encoding context to use.
The encoded string.
Encodes a string for Query String or Form Data encoding.
The text to URL-encode.
The encoding for the text parameter.
The encoding type to use.
The encoded text.
Encodes a string for Query String or Form Data encoding.
The text to URL-encode.
The encoding for the text parameter.
The encoding type to use.
A lazy loaded safelist to use.
The encoded text.
Initializes the HTML safe list.
Creates the safelist
Provides the safe characters for URL parameter encoding.
The safe characters for URL parameter encoding.
Initializes the Url Path safe list.
A list of characters and their encoded values for URL encoding.
Provides the safe characters for URL path encoding.
The safe characters for URL path encoding.
Re-implements the bare necessities of Lazy for .NET 2.0 and 3.5
Specifies the type of object that is being lazily initialized.
Lock object for thread safety.
Creation delegate
Value indicating whether the creation delegate has been called.
The actual value.
Initializes a new instance of the class.
When lazy initialization occurs, the specified initialization function is used.
The delegate that produces the value when it is needed.
Creates and returns a string representation of the Lazy{T}.Value.
The string representation of the Lazy{T}.Value property.
Gets the lazily initialized value of the current Lazy{T} instance.
The lazily initialized value of the current Lazy{T} instance.
Gets a value indicating whether whether a value has been created for this Lazy{T} instance.
true if a value has been created for this Lazy{T} instance; otherwise, false.
Provides LDAP Encoding methods.
The values to output for each character when filter encoding.
The values to output for each character when DN encoding.
Encodes the input string for use in LDAP filters.
The string to encode.
An encoded version of the input string suitable for use in LDAP filters.
Encodes the input string for use in LDAP DNs.
The string to encode.
Value indicating whether the special case rules for encoding of spaces and octothorpes at the start of a string are used.
Value indicating whether the special case for encoding of final character spaces is used.
An encoded version of the input string suitable for use in LDAP DNs.
Initializes the LDAP filter safe list.
The LDAP filter safe list.
Provides the safe characters for LDAP filter encoding.
The safe characters for LDAP filter encoding.
See http://tools.ietf.org/html/rfc4515/
Initializes the LDAP DN safe lists.
The DN safe list.
Provides the safe characters for LDAP filter encoding.
The safe characters for LDAP filter encoding.
See http://www.ietf.org/rfc/rfc2253.txt
Escapes a special DN character.
The safe list to escape the character within.
The character to escape.
Provides safe list utility functions.
Generates a new safe list of the specified size, using the specified function to produce safe values.
The length of the safe list to generate.
The function to use.
A new safe list.
Marks characters from the specified languages as safe.
The safe list to punch holes in.
The combination of lower code charts to use.
The combination of lower mid code charts to use.
The combination of mid code charts to use.
The combination of upper mid code charts to use.
The combination of upper code charts to use.
Punches holes as necessary.
The safe list to punch through.
The list of character positions to punch.
Generates a hash prefixed character array representing the specified value.
The source value.
A character array representing the specified value.
Example inputs and encoded outputs:
- 1#1
- 10#10
- 100#100
Generates a hash prefixed character array representing the specified value in hexadecimal.
The source value.
A character array representing the specified value.
Example inputs and encoded outputs:
- 1#1
- 10#0a
- 100#64
Generates a percent prefixed character array representing the specified value in hexadecimal.
The source value.
A character array representing the specified value.
Example inputs and encoded outputs:
- 1%01
- 10%0a
- 100%64
Generates a slash prefixed character array representing the specified value in hexadecimal.
The source value.
A character array representing the specified value.
Example inputs and encoded outputs:
- 1\01
- 10\0a
- 100\64
Generates a slash prefixed character array representing the specified value in hexadecimal.
The source value.
A character array representing the specified value.
Example inputs and encoded outputs:
- 1\000001
- 10\000000A
- 100\000064
Generates a hash prefixed character array from the specified string.
The source value.
A character array representing the specified value.
Example inputs and encoded outputs:
- 1#1
- 10#10
- 100#100
Generates a percent prefixed character array from the specified string.
The source value.
A character array representing the specified value.
Example inputs and encoded outputs:
- 1%1
- 10%10
- 100%100
Generates a slash prefixed character array from the specified string.
The source value.
A character array representing the specified value.
Example inputs and encoded outputs:
- 1\1
- 10\10
- 100\100
Generates a prefixed character array from the specified string and prefix.
The source value.
The prefix to use.
A prefixed character array representing the specified value.
Punch appropriate holes for the selected code charts.
The safe list to punch through.
The code charts to punch.
Punch appropriate holes for the selected code charts.
The safe list to punch through.
The code charts to punch.
Punch appropriate holes for the selected code charts.
The safe list to punch through.
The code charts to punch.
Punch appropriate holes for the selected code charts.
The safe list to punch through.
The code charts to punch.
Punch appropriate holes for the selected code charts.
The safe list to punch through.
The code charts to punch.
Punches holes as necessary.
The safe list to punch through.
Value indicating whether the holes should be punched.
The list of character positions to punch.
Generates a safe character array representing the specified value.
A safe character array representing the specified value.
The value to generate a safe representation for.
Provides HTML encoding methods.
The HTML escaped value for a space, used in attribute encoding.
The Unicode value for an apostrophe, used in attribute encoding.
The XML named entity for an apostrophe, used in XML encoding.
The current lower code chart settings.
The current lower middle code chart settings.
The current middle code chart settings.
The current upper middle code chart settings.
The current upper code chart settings.
The values to output for each character.
The values to output for HTML named entities.
Lock object
Acquires a read lock.
Releases a read lock.
Acquires a write lock.
Releases a write lock.
Marks characters from the specified languages as safe.
The combination of lower code charts to use.
The combination of lower mid code charts to use.
The combination of mid code charts to use.
The combination of upper mid code charts to use.
The combination of upper code charts to use.
The safe list affects all HTML and XML encoding functions.
Encodes input strings for use in XML.
String to be encoded
Encoded string for use in XML.
Encodes input strings for use in XML.
String to be encoded
Encoded string for use in XML.
Encodes input strings for use in HTML attributes.
String to be encoded
Encoded string for use in HTML attributes.
Encodes input strings for use in HTML.
String to be encoded
Value indicating if the HTML 4.0 named entities should be used.
Encoded string for use in HTML.
Applies Html specific values to the internal value list.
ASP.NET 4 and Razor introduced a new syntax <%: %> and @ which are used to HTML-encode values.
For example, <%: foo %> is shorthand for <%= HttpUtility.HtmlEncode(foo) %>. Since these could
occur inside an attribute, e.g. <a href="@Foo">, ASP.NET mandates that HtmlEncode also encode
characters that are meaningful inside HTML attributes, like the single quote. Encoding spaces
isn't mandatory since it's expected that users will surround such variables with quotes.
HTML Attribute Encoding specific tweaks.
The character to potentially encode.
The encoded character, if any.
True if encoding took place, otherwise false.
XML specific tweaks.
The character to potentially encode.
The encoded character, if any.
True if encoding took place, otherwise false.
XML Attribute Encoding specific tweaks.
The character to potentially encode.
The encoded character, if any.
True if encoding took place, otherwise false.
Encodes input strings for use in HTML.
String to be encoded
Value indicating if the HTML 4.0 named entities should be used.
A function, if needed.
Encoded string for use in HTML.
Initializes the HTML safe list.
Initializes the HTML named entities list.
The HTML named entities list.
Provides method specific encoding of characters.
The character to encode
The encoded character, if it has been encoded.
True if the character has been encoded, otherwise false.
Contains helpers for URI parsing
Query Fragment separators.
Extracts the query string and fragment from the input path by splitting on the separator characters.
Doesn't perform any validation as to whether the input represents a valid URL.
Concatenating the pieces back together will form the original input string.
The URL to split.
The path portion of .
The query and fragment of .
Returns a value indicating whether the schemes used in is generally considered safe for the purposes of redirects or other places where URLs are rendered to the page.
The URL to parse
true if the scheme is considered safe, otherwise false.
Attempts to split a URI into its constituent pieces.
Even if this method returns true, one or more of the out parameters might contain a null or empty string, e.g. if there is no query / fragment.
Concatenating the pieces back together will form the original input string.
The input URI to split.
The scheme and authority used in the uri.
The path contained in the uri.
The query and fragment contained in the uri.
true if the URI could be split, otherwise false.
Reads individual scalar values from a UTF-16 input string.
For performance reasons, this is a mutable struct. Use caution when capturing instances of this type.
Starting code point for the UTF-16 leading surrogates.
Starting code point for the UTF-16 trailing surrogates.
The Unicode replacement character U+FFFD.
For more info, see http://www.unicode.org/charts/PDF/UFFF0.pdf.
The input string we're iterating on.
The current offset into 'input'.
Initializes a new instance of the struct with the given UTF-16 input string.
The input string to decompose into scalar values.
Reads the next scalar value from the input string.
The next scalar value. If the input string contains invalid UTF-16, the
return value is the Unicode replacement character U+FFFD. If the end of the string
is reached, returns -1.
Similar to Char.ConvertToUtf32, but slightly faster in tight loops since parameter checks are not done.
The UTF-16 leading surrogate character.
The UTF-16 trailing surrogate character.
The scalar value resulting from combining these two surrogate characters.
The caller must ensure that the inputs are valid surrogate characters. If not,
the output of this routine is undefined.
Determines whether a given code point is a valid Unicode scalar value.
The code point whose validity is to be checked.
True if the input is a valid Unicode scalar value, false otherwise.
Encapsulates a method that has no parameters and returns a value of the type specified by the TResult parameter.
The type of the return value of the method that this delegate encapsulates.
The return value of the method that this delegate encapsulates.
Encapsulates a method that has one parameter and returns a value of the type specified by the TResult parameter.
The type of the parameter of the method that this delegate encapsulates.
The type of the return value of the method that this delegate encapsulates.
The parameter of the method that this delegate encapsulates.
The return value of the method that this delegate encapsulates.
Indicates that a method is an extension method, or that a class or assembly contains extension methods.
Provides a set of static (Shared in Visual Basic) methods for querying objects that implement IEnumerable<T>.
Generates a sequence of integral numbers within a specified range.
The value of the first integer in the sequence.
The number of sequential integers to generate.
An IEnumerable<Int32> in C# or IEnumerable(Of Int32) in Visual Basic that contains a range of sequential integral numbers.
Filters a sequence of values based on a predicate.
The type of the elements of source.
An IEnumerable<T> to filter.
A function to test each element for a condition.
An IEnumerable<T> that contains elements from the input sequence that satisfy the condition.
Concatenates two sequences.
The type of the elements of the input sequences.
The first sequence to concatenate.
The sequence to concatenate to the first sequence.
An IEnumerable<T> that contains the concatenated elements of the two input sequences.