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

  • Thread starter Thread starter Al Cadalzo
  • Start date Start date
A

Al Cadalzo

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
 
Al Cadalzo said:
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,

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

Al
 
Back
Top