This documentation is archived and is not being maintained.

HttpServerUtility.UrlDecode Method (String, TextWriter)

.NET Framework 1.1

Decodes an HTML string received in a URL and sends the resulting output to a TextWriter output stream.

[Visual Basic]
Overloads Public Sub UrlDecode( _
   ByVal s As String, _
   ByVal output As TextWriter _
public void UrlDecode(
 string s,
 TextWriter output
public: void UrlDecode(
 String* s,
 TextWriter* output
public function UrlDecode(
   s : String,
 output : TextWriter


The HTML string to decode.
The TextWriter output stream containing the decoded string.


URL encoding ensures that all browsers will correctly transmit text in URL strings. Characters such as ?, &,/, and spaces may be truncated or corrupted by some browsers so those characters must be encoded in <A> tags or in query strings where the strings may be re-sent by a browser in a request string.


The following example decodes the string named EncodedString (received in a URL) into the string named DecodedString.

[Visual Basic] 
Dim writer As New StringWriter
Server.UrlDecode(EncodedString, writer)
Dim DecodedString As String = writer.ToString()

StringWriter writer = new StringWriter();
Server.UrlDecode(EncodedString, writer);
String DecodedString = writer.ToString();

StringWriter* writer = new StringWriter();
Server->UrlDecode(EncodedString, writer);
String* DecodedString = writer->ToString();

var writer : StringWriter = new StringWriter()
Server.UrlDecode(encodedString, writer)
var decodedString : String = writer.ToString()


Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

HttpServerUtility Class | HttpServerUtility Members | System.Web Namespace | HttpServerUtility.UrlDecode Overload List