Cannot find HttpServerUtility class in System.Web in C #

I am trying to call the HttpServerUtuility.URLDecode function in C # using Visual Studio 2005, but it cannot be found. I am using System.Web correctly, but the class does not seem to exist. Do I need to add any link to my project?

+7
c # urldecode
source share
3 answers

A few points:

  • You need a reference to the assembly System.Web
  • You need to get the class name correctly ( HttpServerUtility , not HttpServerUtuility )
  • You need to get the method name correctly ( UrlDecode , not UrlDecode )
  • You need an instance of the class, as this is an instance method

Retrieving an instance is likely to be the hardest part, unless you are in ASP.NET β€” it does not have any public constructors or a static property to retrieve the instance. Usually you use HttpContext.Server . An alternative is to use HttpUtility.UrlDecode , which is a static method. (Again, you will need a link to System.Web .)

+14
source

Add a reference to the System.Web assembly.

+5
source

Had to add builds to my api website

 System.Web System.Web.Abstractions System.Web.ApplicationServices 
0
source

All Articles