I'm trying to call the HttpServerUtuility.URLDecode function in C# using Visual Studio 2005, but it can't be found. I'm using System.Web
properly, but the class doesn't seem to be there. Do I need to add some sort of reference to my project?
Asked
Active
Viewed 1.1k times
7

Eli Courtwright
- 186,300
- 67
- 213
- 256
3 Answers
14
A few points:
- You need a reference to the
System.Web
assembly - You need to get the class name right (
HttpServerUtility
, notHttpServerUtuility
) - You need to get the method name right (
UrlDecode
, notURLDecode
) - You need an instance of the class, as it's an instance method
Getting an instance is likely to be the hardest part, unless you're in ASP.NET - it doesn't have any public constructors or a static property to fetch an instance. Usually you'd use HttpContext.Server
. An alternative is to use HttpUtility.UrlDecode
, which is a static method. (Again, you'll need a reference to System.Web
.)

Jon Skeet
- 1,421,763
- 867
- 9,128
- 9,194
6
Add a reference to the System.Web assembly.

Armbrat
- 2,295
- 1
- 23
- 32
-
1Then type HttpServerUtility and press "CTRL + .". Works a charm. – RichardOD Sep 02 '09 at 16:06
0
Had to add assemblies to my web api
System.Web
System.Web.Abstractions
System.Web.ApplicationServices

Evaldas Raisutis
- 1,628
- 4
- 18
- 32