URL URL Encoding

Is there a .NET encoding method that I could use to encode the URL that needs to be passed in the URL parameter?

For example, I have:

url_of_interest = "http://asdf.asdf/asdf.htm"

and I want to include this as one (1) URL form parameter when I upload it to a web application:

http://mywebservice/upload?url=<<encoded URL here>>

+5
source share
5 answers

HttpServerUtility.UrlEncode should do the trick:

http://msdn.microsoft.com/en-us/library/zttxte6w.aspx

+2
source

HttpUtility.UrlEncode

UrlEncode() URL-, . , HTTP, . URL- URL- ; URL . , , URL-, < > % 3c % 3e.

+1

Since System.Web is decommissioned from a modern OWIN-based application, an alternative solution for HttpUtility.UrlEncodeshould beWebUtility.UrlEncode

0
source

All Articles