Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class System.​Net.​WebUtility

Assembly: System.Runtime

Inheritance: object → WebUtility

Provides methods for encoding and decoding URLs when processing Web requests.

Methods

public static string
HtmlDecode​(string value)
Converts a string that has been HTML-encoded for HTTP transmission into a decoded string.
Returns A decoded string.
value The string to decode.
public static void
HtmlDecode​(string value, IO.​TextWriter output)
Converts a string that has been HTML-encoded into a decoded string, and sends the decoded string to a <see cref="T:System.IO.TextWriter" /> output stream.
value The string to decode.
output A <see cref="T:System.IO.TextWriter" /> stream of output.
public static string
HtmlEncode​(string value)
Converts a string to an HTML-encoded string.
Returns An encoded string.
value The string to encode.
public static void
HtmlEncode​(string value, IO.​TextWriter output)
Converts a string into an HTML-encoded string, and returns the output as a <see cref="T:System.IO.TextWriter" /> stream of output.
value The string to encode.
output A <see cref="T:System.IO.TextWriter" /> output stream.
public static string
UrlDecode​(string encodedValue)
Converts a string that has been encoded for transmission in a URL into a decoded string.
Returns A decoded string.
encodedValue A URL-encoded string to decode.
public static byte[]
UrlDecodeToBytes​(byte[] encodedValue, int offset, int count)
Converts an encoded byte array that has been encoded for transmission in a URL into a decoded byte array.
Returns A decoded <see cref="T:System.Byte" /> array.
encodedValue A URL-encoded <see cref="T:System.Byte" /> array to decode.
offset The offset, in bytes, from the start of the <see cref="T:System.Byte" /> array to decode.
count The count, in bytes, to decode from the <see cref="T:System.Byte" /> array.
public static string
UrlEncode​(string value)
Converts a text string into a URL-encoded string.
Returns A URL-encoded string.
value The text to URL-encode.
public static byte[]
UrlEncodeToBytes​(byte[] value, int offset, int count)
Converts a byte array into a URL-encoded byte array.
Returns An encoded <see cref="T:System.Byte" /> array.
value The <see cref="T:System.Byte" /> array to URL-encode.
offset The offset, in bytes, from the start of the <see cref="T:System.Byte" /> array to encode.
count The count, in bytes, to encode from the <see cref="T:System.Byte" /> array.
public bool
Equals​(object obj)
Inherited from object
Determines whether the specified object is equal to the current object.
Returns <see langword="true" /> if the specified object is equal to the current object; otherwise, <see langword="false" /> .
obj The object to compare with the current object.
protected void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public int
GetHashCode​()
Inherited from object
Serves as the default hash function.
Returns A hash code for the current object.
public Type
GetType​()
Inherited from object
Gets the <see cref="T:System.Type" /> of the current instance.
Returns The exact runtime type of the current instance.
protected object
MemberwiseClone​()
Inherited from object
Creates a shallow copy of the current <see cref="T:System.Object" /> .
Returns A shallow copy of the current <see cref="T:System.Object" /> .
public string
ToString​()
Inherited from object
Returns a string that represents the current object.
Returns A string that represents the current object.