user1183690
user1183690

Reputation: 11

System.Web.HttpUtility.UrlEncode c# using

In the following code:

for (int line = 0; line < CHUNKSTOBEFOUND; line++) {
    nvc.Add ("search", System.Web.HttpUtility.UrlEncode (stringsToSearchFor[line]));
}

I get told namespace name HttpUtility does not exist. http://msdn.microsoft.com/en-us/library/system.web.httputility.aspx seems to indicate I should use System.Web. I've tried using that, but I STILL get the error. Is there something else I'm supposed to include or use?

Upvotes: 0

Views: 2777

Answers (2)

Tommaso Belluzzo
Tommaso Belluzzo

Reputation: 23675

As competent_said, you are probably targeting the Client Profile in your project, in which System.Web.dll is not available. You can target the full framework in Project Properties to get it back working.

Another possible cause could be that you are not referencing System.Web library. To do so:

  1. Right click the "Reference" in the Solution Explorer.
  2. Choose "Add Reference"
  3. Check the ".NET" tab is selected.
  4. Search for, and add "System.Web".

Maybe you are just missing an using directive using System.Web; on the top of your source file.

Upvotes: 2

competent_tech
competent_tech

Reputation: 44931

You are most likely using the Client Profile version of the .Net framework. You need to open your project properties and change the framework version to the full version.

Upvotes: 1

Related Questions