Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to use the HttpUtility.UrlEncode method in a winform. However,
the HttpUtility class is not available in intellisense from
System.Web. What do I need to do to be able to use this method? I am using visual studio 2010
Posted
Updated 9-Dec-21 0:12am
v2

You should also be able to use Uri.EscapeUriString()

http://msdn.microsoft.com/en-us/library/system.uri.escapeuristring.aspx[^]

However, System.Web should work but you'll have to add a reference to it, not just declare it with using.
 
Share this answer
 
Comments
Sunil Kumar Pandab 24-Apr-14 7:31am    
But i am not able to reference it. there is no present such tab system.web in add reference->.net library. Does Uri.EscapeUriString() give same result as HttpUtility.UrlEncode?
ZurdoDev 24-Apr-14 7:34am    
As far as I know, yes, it will give you the same thing.
Right click on YourProject -> Properties -> Application Change Target Framework from .Net Framework xx Client Profile to .Net Framework xx

When you remove a Client Profile restriction, you will see System.Web in the .Net (Add Reference) area, then add it as a reference and then put using System.Web in your class.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900