Uri.EscapeDataString Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Converts a string to its escaped representation.

Namespace:  System
Assembly:  System (in System.dll)

Syntax

'Declaration
Public Shared Function EscapeDataString ( _
    stringToEscape As String _
) As String
public static string EscapeDataString(
    string stringToEscape
)

Parameters

Return Value

Type: System.String
A String that contains the escaped representation of stringToEscape.

Exceptions

Exception Condition
ArgumentNullException

stringToEscape is nulla null reference (Nothing in Visual Basic).

UriFormatException

The length of stringToEscape exceeds 32766 characters.

Remarks

The EscapeDataString method converts all characters except for RFC 2396 unreserved characters to their hexadecimal representation. All Unicode characters are converted to UTF-8 format before being escaped.

This method assumes that stringToEscape has no escape sequences in it.

The string is escaped according to RFC 3986. See this RFC for a definition of reserved and unreserved characters.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

See Also

Reference