Solved

c# add System.Web.dll

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PrintingFoundIt(Almost!(Damn!)) 1 37
VB.NET 2008 - SQL Timeout 9 49
c# DateTime Format validation 4 67
Convert VB web project to C# 3 29
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
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…

685 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