System.Web Namespace HttpServerUtility Class
Decodes an HTML string received in a URL and sends the resulting output to a TextWriter output stream.
[ VB ]
Overloads Public Sub UrlDecode ( _
ByVal s As String, _
ByVal output As TextWriter _
)
[ C# ]
public void UrlDecode (
string s,
TextWriter output
);
[ C++ ]
public: void UrlDecode (
String* s,
TextWriter* output
);
[ JScript ]
public function UrlDecode (
s : String,
output : TextWriter
);
- s
- The HTML string to decode.
- output
- The TextWriter output stream containing the decoded string.
URL encoding ensures that all browsers will correctly transmitted text in URL strings. Characters such as "?", "&", "/", and spaces may be truncated or corrupted by some browsers so those characters cannot be used in ASP.NET pages in "<A>" tags or in querystrings where the strings may be 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.
[ VB ]
Dim writer As New StringWriter
Server.UrlDecode ( EncodedString, writer )
Dim DecodedString As String = writer.ToString ( )
[ C# ]
StringWriter writer = new StringWriter ( );
Server.UrlDecode ( EncodedString, writer );
String DecodedString = writer.ToString ( );
HttpServerUtility Members HttpServerUtility.UrlDecode Overload List