Solved

c# add System.Web.dll

Posted on 2010-11-29
5
888 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
Comment Utility
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
Comment Utility
Hi,

Please select it from add reference dialog
0
 
LVL 52

Assisted Solution

by:Carl Tawn
Carl Tawn earned 166 total points
Comment Utility
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
Comment Utility
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
Comment Utility
thank you
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Parse CSS value with RegEx 2 39
How do i select a value on dropdown list on the fly in asp.net 5 37
Linq help 1 16
Chat Room 1 22
Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

728 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

9 Experts available now in Live!

Get 1:1 Help Now