473,396 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Namespace or type '...' for the Imports '...' cannot be found

I'm getting the following error in my ASP.NET application:

Namespace or type 'DirectoryServices' for the Imports
'System.DirectoryServices' cannot be found.

I have added the System.DirectoryServices.dll to my References, and am
including the line "<%@ Import Namespace="System.DirectoryServices" %>" at
the top of the page. I have checked my global assembly cache (both on the
development and the target machine) and both have the correct version of the
assembly (1.0.5000.0).

The server is Windows Server 2003, with all of the latest patches and
updates installed.

I've searched the net and newsgroups and have not yet found any solution to
this one beyond the ususal "Add a reference to System.DirectoryServices.dll"
to your project". Obviously, something deeper is happening here.

Anyone have a clue as to why this isn't working? Thanks!
Nov 18 '05 #1
4 2443
Despite the frustration of running into a problem such as this one, it some
consolation to know that others are sharing the experience. I feel your
pain. See my message "Type not defined error"

"Stephen Cochran" <sc*********@yahoo.com> wrote in message
news:uw**************@tk2msftngp13.phx.gbl...
I'm getting the following error in my ASP.NET application:

Namespace or type 'DirectoryServices' for the Imports
'System.DirectoryServices' cannot be found.

I have added the System.DirectoryServices.dll to my References, and am
including the line "<%@ Import Namespace="System.DirectoryServices" %>" at
the top of the page. I have checked my global assembly cache (both on the
development and the target machine) and both have the correct version of the assembly (1.0.5000.0).

The server is Windows Server 2003, with all of the latest patches and
updates installed.

I've searched the net and newsgroups and have not yet found any solution to this one beyond the ususal "Add a reference to System.DirectoryServices.dll" to your project". Obviously, something deeper is happening here.

Anyone have a clue as to why this isn't working? Thanks!

Nov 18 '05 #2
"Stephen Cochran" <sc*********@yahoo.com> wrote in
news:uw**************@tk2msftngp13.phx.gbl:
I'm getting the following error in my ASP.NET application:

Namespace or type 'DirectoryServices' for the Imports
'System.DirectoryServices' cannot be found.

I have added the System.DirectoryServices.dll to my References,
and am including the line "<%@ Import
Namespace="System.DirectoryServices" %>" at the top of the page.
I have checked my global assembly cache (both on the development
and the target machine) and both have the correct version of the
assembly (1.0.5000.0).

The server is Windows Server 2003, with all of the latest
patches and updates installed.

I've searched the net and newsgroups and have not yet found any
solution to this one beyond the ususal "Add a reference to
System.DirectoryServices.dll" to your project". Obviously,
something deeper is happening here.

Anyone have a clue as to why this isn't working? Thanks!


Stephen,

Just a shot in the dark, but do you have ADSI installed on your
Win2003 machine? From the .Net help file:

<quote>
Both the DirectoryEntry component and DirectorySearcher component
require that you have the ADSI SDK or ADSI runtime installed on your
computer in order to create applications with their functionality.
ADSI 2.5 is installed by default with Windows 2000 or Windows XP.
</quote>

(The help file page is mute regarding Win 2003.)

<url to help file page>
http://msdn.microsoft.com/library/de...l=/library/en-
us/vbcon/html/vbconintroductiontoadsiobjectsinvisualstudio.asp

or

http://tinyurl.com/55g33
</url to help file page>

Do you have the QuickStart tutorials that came with the .Net SDK
installed on the Win2003 machine? If so, those tutorials include two
Active Directory apps. Do those compile and run OK?
(http://localhost/quickstart/howto/)

Using Lutz Roeder's Reflector utility
(http://www.aisto.com/roeder/dotnet/), it appears that
System.DirectoryServices.dll has a dependency on activeds.dll. If
that dll isn't present (or maybe a permissions problem?), it may be
possible that's what's causing the error you are encountering.

--
Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Nov 18 '05 #3
"Chris R. Timmons" <crtimmons@X_NOSPAM_Xcrtimmonsinc.com> wrote in message
news:Xn**********************************@207.46.2 48.16...
Stephen,

Just a shot in the dark, but do you have ADSI installed on your
Win2003 machine? From the .Net help file:

<snip>


Thanks for the reply. Now for a descent into the truly bizarre. A second
ASPX page, based upon the _exact same code_, works. The only difference is
that the first page was built with inline code, and the second was
code-behind. Otherwise, there were no differences (beyond the necessary
inline/code-behind fundamentals) in the code. The original page still fails.

I give up. ASP.NET wins. I'm in the middle of a crash course (learning by
doing), and there seems to be no rhyme or reason to what will work in
code-behind, but not in inline, or vice-versa (works inline, but not in
code-behind). I've been developing for a couple of decades now, and have
been working with VB since 1.0, and likewise ASP since it first came out.
This transition is kicking my butt.

The fun part is when pages built using nothing but designer generated code
fail, but the same operations work inline. Obviously (to me, at least),
there remains a way to go towards perfecting ("workabling"?) ASP.NET.
Nov 18 '05 #4
"Stephen Cochran" <sc*********@yahoo.com> wrote in
news:#8**************@TK2MSFTNGP12.phx.gbl:
Thanks for the reply. Now for a descent into the truly bizarre.
A second ASPX page, based upon the _exact same code_, works. The
only difference is that the first page was built with inline
code, and the second was code-behind. Otherwise, there were no
differences (beyond the necessary inline/code-behind
fundamentals) in the code. The original page still fails.

I give up. ASP.NET wins. I'm in the middle of a crash course
(learning by doing), and there seems to be no rhyme or reason to
what will work in code-behind, but not in inline, or vice-versa
(works inline, but not in code-behind). I've been developing for
a couple of decades now, and have been working with VB since
1.0, and likewise ASP since it first came out. This transition
is kicking my butt.
Stephen,

I think this indicates a permissions problem with the ASPNET account.
The code-behind files that work are compiled under a normal user
account. The inline .aspx files that don't work are compiled under
the ASPNET account when the page is accessed.

I'm not very familiar with Active Directory (AD), but (here's another
shot in the dark :-) ) it may be that the ASPNET account needs to be
given some kind of permission to access AD.

The fun part is when pages built using nothing but designer
generated code fail, but the same operations work inline.
Obviously (to me, at least), there remains a way to go towards
perfecting ("workabling"?) ASP.NET.


Yeah, I went through the same thing. Since I have VS.Net, I just
decided to do everything using the code-behind model, and concentrate
my effort on learning all its quirks.

--
Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Nov 18 '05 #5

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

Similar topics

1
by: BobUp | last post by:
I have created a .NET project which contains a single class object. I need to call a public shared sub in this class from a VB script. The project is called 'Client Script Functions'. The...
5
by: Sting | last post by:
I had a working .net program I've re-installed XP (defective harddisk). and now i keep getting BC30466: Namespace or type 'test' for the Imports 'test' cannot be found. The assembly is called...
1
by: sorCrer | last post by:
Hi All, I have searched for this problem but unusually have had no luck! I have an .vb file in the code directory with the following simplified code in it: Namespace MyTest Public Class...
29
by: Tiraman | last post by:
Hi, I Build my own dll with my own namespace name and i would like to put it in one place but for the project bin folder so all of the projects will be able to use it . i tried to put the dll...
1
by: Michael | last post by:
Please help. I have the following imports in my class file: Imports System.Windows.Forms Imports System.Drawing But I get the following error message when I hover the mouse over the above....
1
by: Arpan | last post by:
I successfully compiled a "Database.vb" file (existing in C:\Inetpub\wwwroot\ASPX\Business) into "Database.dll" (in C:\Inetpub\wwwroot\ASPX\bin). The namespace in "Database.vb" is "Database" which...
3
by: sjt003 | last post by:
I have been developing web apps in Visual Studio 2003, but since the other developers in my office don't use Visual Studio, I may have to stop too unless there is an efficient way for them to...
1
by: Random | last post by:
I'm wondering if anyone has come across this strange behavior in the VS 2005 IDE. I have several classes in my App_Code directory, organized in folders and namespace declarations. Some of these...
2
by: tshad | last post by:
I am using vb.net VS 2003 and can't seem to see my namespace. I have 2 files (form1.vb and DBTypes.vb). My DBTypes.vb is: ************************************************ ' Create to new...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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,...

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.