Uri.EscapeUriString Method
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Converts a URI string to its escaped representation.
Namespace: System
Assembly: System (in System.dll)
Syntax
Public Shared Function EscapeUriString ( _
stringToEscape As String _
) As String
public static string EscapeUriString(
string stringToEscape
)
Parameters
- stringToEscape
Type: System..::.String
The string to escape.
Return Value
Type: System..::.String
A String that contains the escaped representation of stringToEscape.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | stringToEscape is nullNothingnullptra null reference (Nothing in Visual Basic). |
UriFormatException | The length of stringToEscape exceeds 32766 characters. |
Remarks
The EscapeUriString method converts all characters, except RFC 3986 reserved and 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.
Use the EscapeUriString method to prepare an unescaped URI string to be a parameter to the Uri constructor.
Version Information
Windows Phone OS
Supported in: 8.1, 8.0, 7.1, 7.0
Platforms
Windows Phone