Solved

c# add System.Web.dll

Posted on 2010-11-29
5
901 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

828 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