C# Class Microsoft.Framework.WebEncoders.EncoderExtensions

Helpful extension methods for the encoder classes.
显示文件 Open project: lodejard/AllNetCore Class Usage Examples

Public Methods

Method Description
HtmlEncode ( IHtmlEncoder htmlEncoder, string value, TextWriter output ) : void

HTML-encodes a string and writes the result to the supplied output.

The encoded value is also safe for inclusion inside an HTML attribute as long as the attribute value is surrounded by single or double quotes.

JavaScriptStringEncode ( IJavaScriptStringEncoder javaScriptStringEncoder, string value, TextWriter output ) : void

JavaScript-escapes a string and writes the result to the supplied output.

UrlEncode ( IUrlEncoder urlEncoder, string value, TextWriter output ) : void

URL-encodes a string and writes the result to the supplied output.

The encoded value is safe for use in the segment, query, or fragment portion of a URI.

Method Details

HtmlEncode() public static method

HTML-encodes a string and writes the result to the supplied output.
The encoded value is also safe for inclusion inside an HTML attribute as long as the attribute value is surrounded by single or double quotes.
public static HtmlEncode ( IHtmlEncoder htmlEncoder, string value, TextWriter output ) : void
htmlEncoder IHtmlEncoder
value string
output TextWriter
return void

JavaScriptStringEncode() public static method

JavaScript-escapes a string and writes the result to the supplied output.
public static JavaScriptStringEncode ( IJavaScriptStringEncoder javaScriptStringEncoder, string value, TextWriter output ) : void
javaScriptStringEncoder IJavaScriptStringEncoder
value string
output TextWriter
return void

UrlEncode() public static method

URL-encodes a string and writes the result to the supplied output.
The encoded value is safe for use in the segment, query, or fragment portion of a URI.
public static UrlEncode ( IUrlEncoder urlEncoder, string value, TextWriter output ) : void
urlEncoder IUrlEncoder
value string
output TextWriter
return void