HttpServerUtilityBase.UrlEncode Method

Definition

When overridden in a derived class, encodes a string to include only characters that are valid in a URL.

Overloads

UrlEncode(String)

When overridden in a derived class, URL-encodes a string and returns the encoded string.

UrlEncode(String, TextWriter)

When overridden in a derived class, URL-encodes a string and sends the resulting output to a stream.

UrlEncode(String)

When overridden in a derived class, URL-encodes a string and returns the encoded string.

public virtual string UrlEncode(string s);

Parameters

s
String

The text to URL-encode.

Returns

The URL-encoded text.

Exceptions

Applies to

.NET Framework 4.8.1 a další verze
Produkt Verze
.NET Framework 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

UrlEncode(String, TextWriter)

When overridden in a derived class, URL-encodes a string and sends the resulting output to a stream.

public virtual void UrlEncode(string s, System.IO.TextWriter output);

Parameters

s
String

The string to encode.

output
TextWriter

The stream to contain the encoded string.

Exceptions

Remarks

The output parameter is passed by reference to the UrlEncode method. To retrieve the output from the handler after the method completes, you use the properties and methods of the output object. For an example, see UrlEncode.

Applies to

.NET Framework 4.8.1 a další verze
Produkt Verze
.NET Framework 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