httputility does not exist in current context in framework 3.5

Jojo GKH picture Jojo GKH · Feb 22, 2013 · Viewed 8.9k times · Source

I'm trying to use HttpUtility.UrlEncode in my sharepoint project in the framework 3.5 but it doesn't recognise it. Simply saying :

HttpUtility does not exist in current context

I called System.Web but it still doesn't recognise none of the Http objects !

Answer

John Willemse picture John Willemse · Feb 22, 2013

You need to add a reference to System.Web.dll

A using System.Web without the above reference will not suffice alone.

Unfortunately, the System.Web.dll cannot be referenced in a project that targets a Client Profile version of the .Net framework. So look at your project properties and make sure it targets ".NET Framework 3.5" and not ".NET Framework 3.5 Client Profile".