Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add System.Web as a reference if I cant find it in the list of references?

Tags:

c#

system.web

I'm working on a project in C#.Net 4.0. I am trying to use HttpUtility.HtmlDecode. To do so, I added

using System.Web;

to the top of the file. However, no reference to HttpUtility could be found.

After Googling around a little bit I found that the common answer to this question was to add a reference to System.Web.dll by finding it in the list presented by right-clicking on References in the Solution Explorer and clicking "Add Reference...". Unfortunately, this was not in the list. I found System.Web.Services and System.Web.ApplicationServices, but no System.Web, and neither contained what we needed.

Any help appreciated.

like image 903
Ken Bellows Avatar asked Mar 06 '11 05:03

Ken Bellows


People also ask

How do you reference a System Web?

After Googling around a little bit I found that the common answer to this question was to add a reference to System. Web. dll by finding it in the list presented by right-clicking on References in the Solution Explorer and clicking "Add Reference...".

How do you add references to System Web services?

In Solution Explorer, right-click the name of the project to add the Web service to and then click Add Web Reference. The Add Web Reference dialog box is displayed. In the URL box, enter the URL of the Web service to use. If you do not know the URL, use the links in the browse pane to locate the Web service you want.

How do I get System Web DLL?

The best way to get a look under the hood is to create a project and open the References folder. Inside, you'll see all the default libraries, including SYSTEM. WEB. If you right-click a DLL, you can choose "View In Object Browser", which will then open the DLL so you can explore all the stuff inside.


1 Answers

My crystal ball says you are using VS2010. Project + Properties, Application tab, Target framework setting. Change it from the client profile to the regular version.

System.Web is not included in the client profile, that's why you can't find it. Don't worry about the difference, the client profile is only 15% smaller than the regular version. There's very little point to it.

like image 198
Hans Passant Avatar answered Sep 27 '22 02:09

Hans Passant