Uri.UnescapeDataString Method

Converts a string to its unescaped representation.

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

public static string UnescapeDataString (
	string stringToUnescape
public static String UnescapeDataString (
	String stringToUnescape
public static function UnescapeDataString (
	stringToUnescape : String
) : String
Not applicable.



The string to unescape.

Return Value

A String that contains the unescaped representation of stringToUnescape.

Exception typeCondition


stringToUnescape is a null reference (Nothing in Visual Basic).

You should use this method with care. Unescaping a string that has been previously unescaped can lead to ambiguities and errors.

Many Web browsers escape spaces inside of URIs into plus ("+") characters; however, the UnescapeDataString method does not convert plus characters into spaces because this behavior is not standard across all URI schemes.

The following code example unescapes a URI, and then converts any plus characters ("+") into spaces.

String DataString = Uri.UnescapeDataString(".NET+Framework");
Console.WriteLine("Unescaped string: {0}", DataString);

String PlusString = DataString.Replace('+',' ');
Console.WriteLine("plus to space string: {0}", PlusString);

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

.NET Compact Framework

Supported in: 2.0

XNA Framework

Supported in: 1.0

Community Additions