Solved

c# add System.Web.dll

Posted on 2010-11-29
5
897 Views
Last Modified: 2012-06-27
How can i add  c# add System.Web.dll

the error show
Error      1      The name 'HttpUtiltity' does not exist in the current context      C:\Users\¿¿¿7\AppData\Local\Temporary Projects\WindowsFormsApplication1\Form1.cs      28      21      WindowsFormsApplication1

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Web;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string searchString = "song naran"; //or some value retrieved from a form

            System.Diagnostics.Process.Start(
                @"E:\Program Files\Mozilla Firefox\firefox.exe",
                String.Format(
                    "http://www.bing.com/search?q={0} http://search.yahoo.com/search?p={0}",
                    HttpUtiltity.UrlEncode(searchString)));



        }
    }
}

Open in new window

systemweb.png
0
Comment
Question by:teera
5 Comments
 
LVL 10

Accepted Solution

by:
james-ct16 earned 167 total points
ID: 34229709
Howdy
Are you building this project against a Client Profile version of the .net framework if so System.Web is not included in the profile.

To check this simply select the project, right click and select properties, on the application tab there is the target framework, try switching this to framework 4 opposed to framework 4 client profile.

Hope that helps

James
0
 
LVL 5

Expert Comment

by:roxviper
ID: 34229767
Hi,

Please select it from add reference dialog
0
 
LVL 52

Assisted Solution

by:Carl Tawn
Carl Tawn earned 166 total points
ID: 34229873
Since yuo are creating a WinForms application, System.Web isn't included by default.

Right-click your project, choose "Add Reference". In the dialog that appears, scroll down to System.Web; select it and hit "OK".
0
 
LVL 4

Assisted Solution

by:ricovox
ricovox earned 167 total points
ID: 34230593
To add to what carl_tawn said:

System.Web isn't included by default.
Right-click your project, choose "Add Reference".
In the dialog that appears, scroll down to System.Web; select it and hit "OK".

Make sure that you are on the ".NET" tab in the "Add Reference" dialog.
0
 

Author Closing Comment

by:teera
ID: 34235561
thank you
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now