Last post Nov 04, 2010 11:33 PM by vkpatil
Jan 24, 2009 12:39 PM|achor|LINK
I'm develloping and web app that needs access to Active Directoy. I'm doing this trough LDAP.
It's was working fine until I changed the type of project in my Visual Studio 2008 from web site to web application. Now it gives me some errors:
"The type or namespace name 'DirectoryEntry' could not be found (are you missing a using directive or an assembly reference?)"
"The type or namespace name 'DirectorySearcher' could not be found (are you missing a using directive or an assembly reference?)"
"The type or namespace name 'SearchResult' could not be found (are you missing a using directive or an assembly reference?)"
I've been reading some webarticles about web site vs web application, but I'm still not convenced why web app's are better than a website. In my particular case I'm develloping an intranet project, and everything was working fine. If someon could also help
me choose what's best I would be very thankfull.
Anyway, Can someone help me?
All that as to do with that
Jan 24, 2009 07:09 PM|Rick Matthys|LINK
Did System.DirectoryServices somehow get wacked from your references? I assume you know, but for others who may not - expand "References" from the solution explorer and make sure System.DirectoryServices is in there. If not:
Also make sure you're .cs file didn't get tweaked and somehow lost the "using System.DirectoryServices".
FYI, I have web applications that don't have a problem, but then again, they were created as web applications. As for web application vs website, here's a pretty good post
http://west-wind.com/weblog/posts/5601.aspx. Unless you are having some issues with your website (such as deployment or whatever), just keep it as a website project.
Jan 25, 2009 09:28 AM|achor|LINK
Hi Rick! Thanks for the reply.
But I already have those reference. My project compiles without any errors nor warnings.
When I run: " The type or namespace name 'DirectoryServices' does not exist in the namespace 'System'"
I just don't understand, why it can compile without errors and it can't run... This isn't logic.
Do you know what it might be?
My webapplication is building on .NET 3.5 sp1. Visual Studio 2008.
Jan 25, 2009 01:26 PM|Rick Matthys|LINK
FYI, I'm also running the same environment.
I'm not sure what's going on. Could you humor me and give this a try and post back the results.
Create a console app, add a reference to System.DirectoryServices, and add one line of code. Something like:
Run it and see if you get the error. If that works, then try the same thing with a new website.
Jan 26, 2009 05:13 AM|achor|LINK
well i guess somethings just can't be fixed...
I created a new website, and it worked correctly in compile and in run time.
Jan 26, 2009 11:09 AM|Rick Matthys|LINK
All of my projects are websites, not web apps. I'm running VS2008, and do not have any building or deployment issues. From my understanding, web apps came out during VS2005 to address some of those shortcomings. There is no need to create a web app if
the website is working fine for you.
May 26, 2010 10:31 AM|vkpatil|LINK
If you are using web site notice that the references are added to your web.config file for every reference you add to your web site. if you compilation works fine on your box but not on the deployed box then i suggest you check the web.config settings for
typicall you should find reference on that box like below. If you do not find the setting then add one and that should fix it.
<add assembly="System.DirectoryServices, Version=22.214.171.124, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
Directory Services c# vb
Oct 31, 2010 07:48 PM|MrKazoo|LINK
This assembly listing was missing in my webconfig, not sure why, but your fix solved our issue.
Thanks for a great post!
Directory Services c# vb
Nov 04, 2010 11:33 PM|vkpatil|LINK
MrKaZoo, I am glad i was able to help!
It has something to do with the type of the application you selected for your project. If you have selected the project type as web site then you should check assemblies in your web.config file. But if your application is type "web application" then, everything
is taken care for you. I would like to develop my applications as "Web application" for few benefits over the "web site" type.
asp net 2.0