WebUtility Class

Definition

提供在处理 Web 请求时用于编码和解码 URL 的方法。Provides methods for encoding and decoding URLs when processing Web requests.

public ref class WebUtility abstract sealed
public static class WebUtility
type WebUtility = class
Public Class WebUtility
Inheritance
WebUtility

Remarks

HttpUtility 类包含用于 HTML 编码字符串的编码和解码实用工具方法。The HttpUtility class contains encoding and decoding utility methods for use with HTML-encode strings. System.Uri 类还包含可用于类似用途的方法和属性。The System.Uri class also contains methods and properties that can be used for similar purposes.

Methods

HtmlDecode(String)

将已经为 HTTP 传输进行过 HTML 编码的字符串转换为已解码的字符串。Converts a string that has been HTML-encoded for HTTP transmission into a decoded string.

HtmlDecode(String, TextWriter)

将已经过 HTML 编码的字符串转换为已解码的字符串并将其发送给 TextWriter 输出流。Converts a string that has been HTML-encoded into a decoded string, and sends the decoded string to a TextWriter output stream.

HtmlEncode(String)

将字符串转换为 HTML 编码字符串。Converts a string to an HTML-encoded string.

HtmlEncode(String, TextWriter)

将字符串转换为 HTML 编码的字符串,并以 TextWriter 输出流的形式返回输出。Converts a string into an HTML-encoded string, and returns the output as a TextWriter stream of output.

UrlDecode(String)

将已编码用于 URL 传输的字符串转换为解码的字符串。Converts a string that has been encoded for transmission in a URL into a decoded string.

UrlDecodeToBytes(Byte[], Int32, Int32)

将为通过 URL 传输已编码的已编码字节数组转换为解码的字节数组。Converts an encoded byte array that has been encoded for transmission in a URL into a decoded byte array.

UrlEncode(String)

将文本字符串转换为 URL 编码的字符串。Converts a text string into a URL-encoded string.

UrlEncodeToBytes(Byte[], Int32, Int32)

将字节数组转换为 URL 编码的字节数组。Converts a byte array into a URL-encoded byte array.

Applies to

See also