HttpUtility.UrlDecode Method

Definition

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

To encode or decode values outside of a web application, use the WebUtility class.

Overloads

UrlDecode(String, Encoding)

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

UrlDecode(Byte[], Int32, Int32, 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.

UrlDecode(String)

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

UrlDecode(Byte[], Encoding)

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

UrlDecode(String, Encoding)

Source:
HttpUtility.cs
Source:
HttpUtility.cs
Source:
HttpUtility.cs

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

C#
public static string? UrlDecode (string? str, System.Text.Encoding e);
C#
public static string UrlDecode (string str, System.Text.Encoding e);

Parameters

str
String

The string to decode.

e
Encoding

The Encoding that specifies the decoding scheme.

Returns

A decoded string.

Remarks

If characters such as blanks and punctuation are passed in an HTTP stream, they might be misinterpreted at the receiving end. URL encoding converts characters that are not allowed in a URL into character-entity equivalents; URL decoding reverses the encoding. For example, when embedded in a block of text to be transmitted in a URL, the characters < and > are encoded as %3c and %3e.

To encode or decode values outside of a web application, use the WebUtility class.

See also

Applies to

.NET 9 및 기타 버전
제품 버전
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

UrlDecode(Byte[], Int32, Int32, Encoding)

Source:
HttpUtility.cs
Source:
HttpUtility.cs
Source:
HttpUtility.cs

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.

C#
public static string? UrlDecode (byte[]? bytes, int offset, int count, System.Text.Encoding e);
C#
public static string UrlDecode (byte[] bytes, int offset, int count, System.Text.Encoding e);

Parameters

bytes
Byte[]

The array of bytes to decode.

offset
Int32

The position in the byte to begin decoding.

count
Int32

The number of bytes to decode.

e
Encoding

The Encoding object that specifies the decoding scheme.

Returns

A decoded string.

Exceptions

bytes is null, but count does not equal 0.

offset is less than 0 or greater than the length of the bytes array.

-or-

count is less than 0, or count + offset is greater than the length of the bytes array.

Remarks

If characters such as blanks and punctuation are passed in an HTTP stream, they might be misinterpreted at the receiving end. URL encoding converts characters that are not allowed in a URL into character-entity equivalents; URL decoding reverses the encoding. For example, when embedded in a block of text to be transmitted in a URL the characters < and > are encoded as %3c and %3e.

To encode or decode values outside of a web application, use the WebUtility class.

See also

Applies to

.NET 9 및 기타 버전
제품 버전
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

UrlDecode(String)

Source:
HttpUtility.cs
Source:
HttpUtility.cs
Source:
HttpUtility.cs

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

C#
public static string? UrlDecode (string? str);
C#
public static string UrlDecode (string str);

Parameters

str
String

The string to decode.

Returns

A decoded string.

Remarks

If characters such as blanks and punctuation are passed in an HTTP stream, they might be misinterpreted at the receiving end. URL encoding converts characters that are not allowed in a URL into character-entity equivalents; URL decoding reverses the encoding. For example, when embedded in a block of text to be transmitted in a URL, the characters < and > are encoded as %3c and %3e.

To encode or decode values outside of a web application, use the WebUtility class.

See also

Applies to

.NET 9 및 기타 버전
제품 버전
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

UrlDecode(Byte[], Encoding)

Source:
HttpUtility.cs
Source:
HttpUtility.cs
Source:
HttpUtility.cs

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

C#
public static string? UrlDecode (byte[]? bytes, System.Text.Encoding e);
C#
public static string UrlDecode (byte[] bytes, System.Text.Encoding e);

Parameters

bytes
Byte[]

The array of bytes to decode.

e
Encoding

The Encoding that specifies the decoding scheme.

Returns

A decoded string.

Remarks

If characters such as blanks and punctuation are passed in an HTTP stream, they might be misinterpreted at the receiving end. URL encoding converts characters that are not allowed in a URL into character-entity equivalents; URL decoding reverses the encoding. For example, when embedded in a block of text to be transmitted in a URL, the characters < and > are encoded as %3c and %3e.

To encode or decode values outside of a web application, use the WebUtility class.

See also

Applies to

.NET 9 및 기타 버전
제품 버전
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1