public static string UrlEncode (String str)
urlencode (String) method can be used to encode the entire URL, including query string values. If there are no encoding cases, such as spaces and punctuation characters passed in an HTTP stream, they may be incorrectly interpreted on the receiving side. url encoding is converted to the character entity equivalent; The character URL in the URL is not allowed to decode the reversed encoding. For example, when character < and > are embedded in a block of text to be transferred in the URL, they are encoded as%3 C and%3e.
You can encode the URLs that you useUrlEncode method or Urlpathencode method. However, these methods return different results. The UrlEncode method converts each space character to a plus character (+).
HttpUtility. The UrlEncode method uses UTF-8 encoding by default. Therefore, the UrlEncode method is used to provide the same result as the UrlEncode method and to specify UTF8 as the second parameter.
Webutility (provides a way to encode and decode URLs when processing WEB requests. )