Uri.UnescapeDataString Method

Note: This method is new in the .NET Framework version 2.0.

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



The string to unescape.

Return Value

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 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 .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

.NET Compact Framework

Supported in: 2.0