Table of Contents

Class HttpUtility

Namespace
System.Web
Assembly
System.Net.Http.dll

Utilities to encode and decode URLs.

public class HttpUtility
Inheritance
HttpUtility
Inherited Members
Extension Methods

Constructors

HttpUtility()

public HttpUtility()

Methods

HexToInt(char)

Get the int value of a char.

public static int HexToInt(char h)

Parameters

h char

The char to convert.

Returns

int

The int value of the char.

UrlDecode(byte[], int, int, Encoding)

Converts a URL-encoded byte array into a decoded string using the specified encoding object, starting at the specified position in the array, and continuing for the specified number of bytes.

public static string UrlDecode(byte[] bytes, int offset, int count, Encoding e)

Parameters

bytes byte[]

The array of bytes to decode.

offset int

The position in the byte to begin decoding

count int

The number of bytes to decode.

e Encoding

The Encoding object that specifies the encoding scheme.

Returns

string

A decoded string.

UrlDecode(byte[], Encoding)

Converts a URL-encoded byte array into a decoded string using the specified decoding object.

public static string UrlDecode(byte[] bytes, Encoding e)

Parameters

bytes byte[]

The array of bytes to decode.

e Encoding

The Encoding object that specifies the encoding scheme.

Returns

string

A decoded string.

UrlDecode(string)

Converts a string that has been encoded for transmission in a URL into a decoded string.

public static string UrlDecode(string str)

Parameters

str string

The string to decode.

Returns

string

The decoded URL

UrlDecode(string, Encoding)

Converts a URL-encoded string into a decoded string, using the specified encoding object.

public static string UrlDecode(string str, Encoding e)

Parameters

str string

The string to decode.

e Encoding

The Encoding that specifies the decoding scheme.

Returns

string

A decoded string.

UrlDecodeToBytes(byte[])

Converts a URL-encoded array of bytes into a decoded array of bytes.

public static byte[] UrlDecodeToBytes(byte[] bytes)

Parameters

bytes byte[]

The array of bytes to decode.

Returns

byte[]

A decoded array of bytes.

UrlDecodeToBytes(byte[], int, int)

Converts a URL-encoded array of bytes into a decoded array of bytes, starting at the specified position in the array and continuing for the specified number of bytes.

public static byte[] UrlDecodeToBytes(byte[] bytes, int offset, int count)

Parameters

bytes byte[]

The array of bytes to decode.

offset int

The position in the byte array at which to begin decoding.

count int

The number of bytes to decode.

Returns

byte[]

A decoded array of bytes.

UrlDecodeToBytes(string)

Converts a URL-encoded string into a decoded array of bytes.

public static byte[] UrlDecodeToBytes(string str)

Parameters

str string

The string to decode.

Returns

byte[]

A decoded array of bytes.

UrlDecodeToBytes(string, Encoding)

Converts a URL-encoded string into a decoded array of bytes using the specified decoding object.

public static byte[] UrlDecodeToBytes(string str, Encoding e)

Parameters

str string

The string to encode.

e Encoding

The Encoding object that specifies the encoding scheme.

Returns

byte[]

A decoded array of bytes.

UrlEncode(byte[])

Converts a byte array into an encoded URL string.

public static string UrlEncode(byte[] bytes)

Parameters

bytes byte[]

The array of bytes to encode.

Returns

string

An encoded string.

UrlEncode(byte[], int, int)

Converts a byte array into a URL-encoded string, starting at the specified position in the array and continuing for the specified number of bytes.

public static string UrlEncode(byte[] bytes, int offset, int count)

Parameters

bytes byte[]

The array of bytes to encode.

offset int

The position in the byte array at which to begin encoding.

count int

The number of bytes to encode.

Returns

string

An encoded string.

UrlEncode(string)

Encodes a URL string.

public static string UrlEncode(string str)

Parameters

str string

The text to encode.

Returns

string

An encoded string.

UrlEncode(string, Encoding)

Encodes a URL string using the specified encoding object.

public static string UrlEncode(string str, Encoding e)

Parameters

str string

The text to encode.

e Encoding

The Encoding object that specifies the encoding scheme.

Returns

string

An encoded string.

UrlEncodeToBytes(byte[])

Converts a URL-encoded array of bytes into a decoded array of bytes.

public static byte[] UrlEncodeToBytes(byte[] bytes)

Parameters

bytes byte[]

The array of bytes to encode

Returns

byte[]

A decoded array of bytes.

UrlEncodeToBytes(byte[], int, int)

Converts an array of bytes into a URL-encoded array of bytes, starting at the specified position in the array and continuing for the specified number of bytes.

public static byte[] UrlEncodeToBytes(byte[] bytes, int offset, int count)

Parameters

bytes byte[]

The array of bytes to encode

offset int

The position in the byte array at which to begin encoding

count int

The number of bytes to encode

Returns

byte[]

An encoded array of bytes.

UrlEncodeToBytes(string, Encoding)

Converts a string into a URL-encoded array of bytes using the specified encoding object.

public static byte[] UrlEncodeToBytes(string str, Encoding e)

Parameters

str string

The string to encode.

e Encoding

The Encoding that specifies the encoding scheme.

Returns

byte[]

An encoded array of bytes.