#region 程序集 System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Web.dll
#endregion
using System.Collections.Specialized;
using System.IO;
using System.Text;
namespace System.Web
{
//
// 摘要:
// 提供在处理 Web 请求时用于编码和解码 URL 的方法。 此类不能被继承。
public sealed class HttpUtility
{
//
// 摘要:
// 初始化 System.Web.HttpUtility 类的新实例。
public HttpUtility();
//
// 摘要:
// 将字符串最小限度地转换为 HTML 编码的字符串。
//
// 参数:
// s:
// 要编码的字符串。
//
// 返回结果:
// 已编码的字符串。
public static string HtmlAttributeEncode(string s);
//
// 摘要:
// 将字符串最小限度地转换为 HTML 编码的字符串,并将编码的字符串发送到 System.IO.TextWriter 输出流。
//
// 参数:
// s:
// 要编码的字符串
//
// output:
// System.IO.TextWriter 输出流。
public static void HtmlAttributeEncode(string s, TextWriter output);
//
// 摘要:
// 将已经为 HTTP 传输进行过 HTML 编码的字符串转换为已解码的字符串。
//
// 参数:
// s:
// 要解码的字符串。
//
// 返回结果:
// 已解码的字符串。
public static string HtmlDecode(string s);
//
// 摘要:
// 将已经过 HTML 编码的字符串转换为已解码的字符串并将其发送给 System.IO.TextWriter 输出流。
//
// 参数:
// s:
// 要解码的字符串。
//
// output:
// System.IO.TextWriter 输出流。
public static void HtmlDecode(string s, TextWriter output);
//
// 摘要:
// 将字符串转换为 HTML 编码字符串。
//
// 参数:
// s:
// 要编码的字符串。
//
// 返回结果:
// 已编码的字符串。
public static string HtmlEncode(string s);
//
// 摘要:
// 将对象的字符串表示形式转换为 HTML 编码的字符串,并返回已编码的字符串。
//
// 参数:
// value:
// 一个对象。
//
// 返回结果:
// 已编码的字符串。
public static string HtmlEncode(object value);
//
// 摘要:
// 将字符串转换为 HTML 编码的字符串,并以 System.IO.TextWriter 输出流的形式返回输出。
//
// 参数:
// s:
// 要编码的字符串
//
// output:
// System.IO.TextWriter 输出流。
public static void HtmlEncode(string s, TextWriter output);
//
// 摘要:
// 对字符串进行编码。
//
// 参数:
// value:
// 要编码的字符串。
//
// 返回结果:
// 已编码的字符串。
public static string JavaScriptStringEncode(string value);
//
// 摘要:
// 对字符串进行编码。
//
// 参数:
// value:
// 要编码的字符串。
//
// addDoubleQuotes:
// 一个指示双引号是否将包含在已编码字符串周围的值。
//
// 返回结果:
// 已编码的字符串。
public static string JavaScriptStringEncode(string value, bool addDoubleQuotes);
//
// 摘要:
// 使用 System.Text.Encoding.UTF8 编码将查询字符串分析成一个 System.Collections.Specialized.NameValueCollection。
//
// 参数:
// query:
// 要分析的查询字符串。
//
// 返回结果:
// 查询参数和值的 System.Collections.Specialized.NameValueCollection。
//
// 异常:
// T:System.ArgumentNullException:
// query 为 null。
public static NameValueCollection ParseQueryString(string query);
//
// 摘要:
// 使用指定的 System.Text.Encoding 将查询字符串分析成一个 System.Collections.Specialized.NameValueCollection。
//
// 参数:
// query:
// 要分析的查询字符串。
//
// encoding:
// 要使用的 System.Text.Encoding。
//
// 返回结果:
// 查询参数和值的 System.Collections.Specialized.NameValueCollection。
//
// 异常:
// T:System.ArgumentNullException:
// query 为 null。 - 或 - encoding 为 null。
public static NameValueCollection ParseQueryString(string query, Encoding encoding);
//
// 摘要:
// 使用指定的编码对象将 URL 编码字节数据转换为已解码的字符串,从数组中的指定位置开始,直到指定的字节数。
//
// 参数:
// bytes:
// 要解码的字节数组。
//
// offset:
// 字节中开始解码的位置。
//
// count:
// 要解码的字节数。
//
// e:
// 指定解码方案的 System.Text.Encoding 对象。
//
// 返回结果:
// 已解码的字符串。
//
// 异常:
// T:System.ArgumentNullException:
// bytes 为 null,但是 count 不等于 0。
//
// T:System.ArgumentOutOfRangeException:
// offset 小于 0 或大于 bytes 数组的长度。 - 或 - count 小于 0,或 count + offset 大于 bytes 数组的长度。
public static string UrlDecode(byte[] bytes, int offset, int count, Encoding e);
//
// 摘要:
// 将已编码用于 URL 传输的字符串转换为解码的字符串。
//
// 参数:
// str:
// 要解码的字符串。
//
// 返回结果:
// 已解码的字符串。
public static string UrlDecode(string str);
//
// 摘要:
// 使用指定的编码对象将 URL 编码的字符串转换为解码的字符串。
//
// 参数:
// str:
// 要解码的字符串。
//
// e:
// 指定解码方案的 System.Text.Encoding。
//
// 返回结果:
// 已解码的字符串。
public static string UrlDecode(string str, Encoding e);
//
// 摘要:
// 使用指定的解码对象将 URL 编码的字节数组转换为解码的字符串。
//
// 参数:
// bytes:
// 要解码的字节数组。
//
// e:
// 指定解码方案的 System.Text.Encoding。
//
// 返回结果:
// 已解码的字符串。
public static string UrlDecode(byte[] bytes, Encoding e);
//
// 摘要:
// 从数组中的指定位置开始一直到指定的字节数为止,将 URL 编码的字节数组转换为已解码的字节数组。
//
// 参数:
// bytes:
// 要解码的字节数组。
//
// offset:
// 字节数组中开始解码的位置。
//
// count:
// 要解码的字节数。
//
// 返回结果:
// 一个已解码的字节数组。
//
// 异常:
// T:System.ArgumentNullException:
// bytes 为 null,但是 count 不等于 0。
//
// T:System.ArgumentOutOfRangeException:
// offset 小于 0 或大于 bytes 数组的长度。 - 或 - count 小于 0,或 count + offset 大于 bytes 数组的长度。
public static byte[] UrlDecodeToBytes(byte[] bytes, int offset, int count);
//
// 摘要:
// 将 URL 编码的字节数组转换为解码后的字节数组。
//
// 参数:
// bytes:
// 要解码的字节数组。
//
// 返回结果:
// 一个已解码的字节数组。
public static byte[] UrlDecodeToBytes(byte[] bytes);
//
// 摘要:
// 使用指定的解码对象将 URL 编码的字符串转换为已解码的字节数组。
//
// 参数:
// str:
// 要解码的字符串。
//
// e:
// 指定解码方案的 System.Text.Encoding 对象。
//
// 返回结果:
// 一个已解码的字节数组。
public static byte[] UrlDecodeToBytes(string str, Encoding e);
//
// 摘要:
// 将 URL 编码的字符串转换为解码的字节数组。
//
// 参数:
// str:
// 要解码的字符串。
//
// 返回结果:
// 一个已解码的字节数组。
public static byte[] UrlDecodeToBytes(string str);
//
// 摘要:
// 对 URL 字符串进行编码。
//
// 参数:
// str:
// 要编码的文本。
//
// 返回结果:
// 已编码的字符串。
public static string UrlEncode(string str);
//
// 摘要:
// 使用指定的编码对象,对 URL 字符串进行编码。
//
// 参数:
// str:
// 要编码的文本。
//
// e:
// 指定编码方案的 System.Text.Encoding 对象。
//
// 返回结果:
// 已编码的字符串。
public static string UrlEncode(string str, Encoding e);
//
// 摘要:
// 将字节数组转换为编码的 URL 字符串。
//
// 参数:
// bytes:
// 要编码的字节数组。
//
// 返回结果:
// 已编码的字符串。
public static string UrlEncode(byte[] bytes);
//
// 摘要:
// 从数组中指定位置开始,按照指定字节数量,将字节数组转换为 URL 编码的字符串。
//
// 参数:
// bytes:
// 要编码的字节数组。
//
// offset:
// 从其开始编码的字节数组中的位置。
//
// count:
// 要编码的字节数。
//
// 返回结果:
// 已编码的字符串。
public static string UrlEncode(byte[] bytes, int offset, int count);
//
// 摘要:
// 将字符串转换为 URL 编码的字节数组。
//
// 参数:
// str:
// 要编码的字符串。
//
// 返回结果:
// 编码的字节数组。
public static byte[] UrlEncodeToBytes(string str);
//
// 摘要:
// 将字节数组转换为 URL 编码的字节数组,从数组中指定位置开始,以指定字节数继续。
//
// 参数:
// bytes:
// 要编码的字节数组。
//
// offset:
// 从其开始编码的字节数组中的位置。
//
// count:
// 要编码的字节数。
//
// 返回结果:
// 编码的字节数组。
//
// 异常:
// T:System.ArgumentNullException:
// bytes 为 null,但是 count 不等于 0。
//
// T:System.ArgumentOutOfRangeException:
// offset 小于 0 或大于 bytes 数组的长度。 - 或 - count 小于 0,或 count + offset 大于 bytes 数组的长度。
public static byte[] UrlEncodeToBytes(byte[] bytes, int offset, int count);
//
// 摘要:
// 将字节数组转换为 URL 编码的字节数组。
//
// 参数:
// bytes:
// 要编码的字节数组。
//
// 返回结果:
// 编码的字节数组。
public static byte[] UrlEncodeToBytes(byte[] bytes);
//
// 摘要:
// 使用指定的编码对象将字符串转换为 URL 编码的字节数组。
//
// 参数:
// str:
// 要编码的字符串
//
// e:
// 指定编码方案的 System.Text.Encoding。
//
// 返回结果:
// 编码的字节数组。
public static byte[] UrlEncodeToBytes(string str, Encoding e);
//
// 摘要:
// 将字符串转换为 Unicode 字符串。
//
// 参数:
// str:
// 要转换的字符串。
//
// 返回结果:
// 采用 %UnicodeValue 表示法的 Unicode 字符串。
[Obsolete("This method produces non-standards-compliant output and has interoperability issues. The preferred alternative is UrlEncode(String).")]
public static string UrlEncodeUnicode(string str);
//
// 摘要:
// 将 Unicode 字符串转换为字节数组。
//
// 参数:
// str:
// 要转换的字符串。
//
// 返回结果:
// 字节数组。
[Obsolete("This method produces non-standards-compliant output and has interoperability issues. The preferred alternative is UrlEncodeToBytes(String).")]
public static byte[] UrlEncodeUnicodeToBytes(string str);
//
// 摘要:
// 请勿使用;仅适用于浏览器兼容性。 请使用 System.Web.HttpUtility.UrlEncode(System.String)。
//
// 参数:
// str:
// 要编码的文本。
//
// 返回结果:
// 编码的文本。
public static string UrlPathEncode(string str);
}
}