473,473 Members | 2,286 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

The type or namespace name 'Net' could not be found

I get the compile error:
"The type or namespace name 'Net' could not be found"
on this line of code:

Net.HttpWebResponse resp = null;

Here are my using directives:
using System;
using System.Data;
using System.Data.SqlClient;
using System.IO;

If I say 'System.Net.HttpWebResponse' then the error goes away.

I have a similar problem when I declare a SqlConnection

If I say SqlClient.SqlConnection I get the error, but If I say just
'SqlConnection' then it's OK.
It seems as though the 'using System' directive and the 'using System.Data'
directive are being ignored.

I assembly references to System, System.Data and System.XML.

I don't have any problem with the 'using System.IO;' directive.

Any ideas?

Thanks,
Al
Nov 15 '05 #1
4 1947
bB
Add the following directive:

using System.Net;

Tim

"Al Cadalzo" <ca*****@hotmail.com> wrote in message
news:#o**************@TK2MSFTNGP10.phx.gbl...
I get the compile error:
"The type or namespace name 'Net' could not be found"
on this line of code:

Net.HttpWebResponse resp = null;

Here are my using directives:
using System;
using System.Data;
using System.Data.SqlClient;
using System.IO;

If I say 'System.Net.HttpWebResponse' then the error goes away.

I have a similar problem when I declare a SqlConnection

If I say SqlClient.SqlConnection I get the error, but If I say just
'SqlConnection' then it's OK.
It seems as though the 'using System' directive and the 'using System.Data' directive are being ignored.

I assembly references to System, System.Data and System.XML.

I don't have any problem with the 'using System.IO;' directive.

Any ideas?

Thanks,
Al

Nov 15 '05 #2
Al Cadalzo <ca*****@hotmail.com> wrote:
I get the compile error:
"The type or namespace name 'Net' could not be found"
on this line of code:

Net.HttpWebResponse resp = null;


Yes. That's because the "using" statement doesn't mean you can use
partial *namespaces*, it just means you can use unqualified type names.

Just include:

using System.Net;

and then just use

HttpWebResponse resp = null;

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #3
Thanks Tim.
I am used to the way you can use partial namespace in VB.NET.

Al

"bB" <ti*@aterminal.free-serve.co.uk.dontspamme> wrote in message
news:Oh**************@tk2msftngp13.phx.gbl...
Add the following directive:

using System.Net;

Tim

"Al Cadalzo" <ca*****@hotmail.com> wrote in message
news:#o**************@TK2MSFTNGP10.phx.gbl...
I get the compile error:
"The type or namespace name 'Net' could not be found"
on this line of code:

Net.HttpWebResponse resp = null;

Here are my using directives:
using System;
using System.Data;
using System.Data.SqlClient;
using System.IO;

If I say 'System.Net.HttpWebResponse' then the error goes away.

I have a similar problem when I declare a SqlConnection

If I say SqlClient.SqlConnection I get the error, but If I say just
'SqlConnection' then it's OK.
It seems as though the 'using System' directive and the 'using

System.Data'
directive are being ignored.

I assembly references to System, System.Data and System.XML.

I don't have any problem with the 'using System.IO;' directive.

Any ideas?

Thanks,
Al


Nov 15 '05 #4
Jon,

Thanks alot. I guess it works a bit differently than the imports directive
I'm used to in VB.Net.

Al
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Al Cadalzo <ca*****@hotmail.com> wrote:
I get the compile error:
"The type or namespace name 'Net' could not be found"
on this line of code:

Net.HttpWebResponse resp = null;


Yes. That's because the "using" statement doesn't mean you can use
partial *namespaces*, it just means you can use unqualified type names.

Just include:

using System.Net;

and then just use

HttpWebResponse resp = null;

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Chris Smith | last post by:
Experience posters, I am an experienced vb/vb.net developer but having a bit of trouble converting a bit of code to C#. I have 3 projects in one solution. Trying to create a plug-in type...
1
by: Randall Parker | last post by:
Using VS 2003 and Cassini web server. I'm new to ASP.Net and so this may be a dumb question. I'm getting an error where the type 'FarmLand.WebForm1' is not found. The Codebehind C# source file...
7
by: John Grandy | last post by:
My ASP.NET Web Service project has a Web Method that returns an array filled with instances of a custom class. The custom class is defined in a Class Library that is included in the web-service...
1
by: Marc | last post by:
Hi! I'm working with a C# client that calls a php web service. I've created a wrapper to call the service using .NET wsdl tool (adding a web reference). The call to the server works fine, it...
2
by: AnalogKid17 | last post by:
Keywords: ASP.NET app with VS2005 running on Win2003 with IIS6, and SQL2000 on a WinXP Box I've betting the following for days... it's driving me insane: Server Error in '/' Application. ...
0
by: WebDev2 | last post by:
I can't get AJAX.NET Pro to work. I keep getting a Compiler Error Message: CS0246: The type or namespace name 'AjaxPro' could not be found (are you missing a using directive or an assembly...
6
by: antonyliu2002 | last post by:
Hi, guys, I am using Visual Web Developer Express 2005 for my web application. I wrote a simple class called MyTestClass.cs and put it in the App_Code folder. I compiled it to library from...
2
by: Andrus | last post by:
I'm trying to compile myGeneration PropertyCollectionAll.cs file with VCS Express 2005 bot got error Error 1 The type or namespace name 'Collection' could not be found (are you missing a using...
5
by: mknoll217 | last post by:
I am a newbie at XML. I have been given an xml document that I need to write the schema for, for a class assignment. The xml given to me is <?xml version="1.0"?> <Vendors> <Vendor> ...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.