Editar

Partilhar via


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.

public:
 static System::String ^ UrlDecode(System::String ^ str, System::Text::Encoding ^ e);
public static string? UrlDecode (string? str, System.Text.Encoding e);
public static string UrlDecode (string str, System.Text.Encoding e);
static member UrlDecode : string * System.Text.Encoding -> string
Public Shared Function UrlDecode (str As String, e As Encoding) As String

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

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.

public:
 static System::String ^ UrlDecode(cli::array <System::Byte> ^ bytes, int offset, int count, System::Text::Encoding ^ e);
public static string? UrlDecode (byte[]? bytes, int offset, int count, System.Text.Encoding e);
public static string UrlDecode (byte[] bytes, int offset, int count, System.Text.Encoding e);
static member UrlDecode : byte[] * int * int * System.Text.Encoding -> string
Public Shared Function UrlDecode (bytes As Byte(), offset As Integer, count As Integer, e As Encoding) As String

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

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.

public:
 static System::String ^ UrlDecode(System::String ^ str);
public static string? UrlDecode (string? str);
public static string UrlDecode (string str);
static member UrlDecode : string -> string
Public Shared Function UrlDecode (str As String) As String

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

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.

public:
 static System::String ^ UrlDecode(cli::array <System::Byte> ^ bytes, System::Text::Encoding ^ e);
public static string? UrlDecode (byte[]? bytes, System.Text.Encoding e);
public static string UrlDecode (byte[] bytes, System.Text.Encoding e);
static member UrlDecode : byte[] * System.Text.Encoding -> string
Public Shared Function UrlDecode (bytes As Byte(), e As Encoding) As String

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