HttpServerUtility.UrlEncode Method


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Encodes a string for reliable HTTP transmission from the Web server to a client through the URL.

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


URL-encodes a string and returns the encoded string.

System_CAPS_pubmethodUrlEncode(String, TextWriter)

URL-encodes a string and sends the resulting output to a TextWriter output stream.

UrlEncode is a convenient way to access the HttpUtility.UrlEncode method at run time from an ASP.NET application. Internally, UrlEncode uses HttpUtility.UrlEncode to encode strings.

To encode or decode values outside of a web application, use the WebUtility class.

Return to top