Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

use UrlEncode in windows application 1

Status
Not open for further replies.

harmmeijer

Programmer
Mar 1, 2001
869
CN
I need to urlEncode and urldecode (escape and unescape in javascript) some strings.

Problem is that the methods used in .net (UrlEncode UrlDecode) are methods of the HttpServerUtility.




I don't have an instance of HttpServerUtility in a windows application.

Examples of these methods all assume that your project is a asp.net app.


Is this a logical mistake of MS assuming that you only need to encode to URL and URL decode in an asp.net app?
Does anyone know how can I use these functions in a windows application?



Greetings, Harm Meijer
 
yes, you can use this, using the following code

System.Web.httputility.urlencode("test")

however you must have created a reference to system.web in your project, just importing it will not work.

hope this helps
 
You are correct, I thought it generated an error (something like have to create an instance ...).

Must have been my sloppy way of working because when I try it now I don't get an error.

Thanks




Greetings, Harm Meijer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top