justanotherguy justanotherguy - 8 months ago 204
Vb.net Question

Cannot load System.DirectoryServices.AccountManagement in ASP.NET VB site

I have been working on adding Active Directory functionality to an already existing ASP.NET website following this guide by Microsoft: http://support.microsoft.com/kb/326340. It's been a long process, but what I'm stuck on now is not being able to access the AccountManagement class to use certain functions such as "GetGroup()".

I can access DirectoryServices just fine, but not Account Management. When I use the following code to test the reference:


I get this error: BC30456: 'AccountManagement' is not a member of 'DirectoryServices'.

I have already added this assembly tag to the web.config page:

<add assembly="System.DirectoryServices, Version=, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />

Also I am importing both namespaces:

<%@ Import Namespace="System.DirectoryServices" %>
<%@ Import Namespace="System.DirectoryServices.AccountManagement" %>

And this is my version info that shows on the error page:

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34237

I'm editing this website in VS 2010. What am I missing and how can I get AccountManagement added here? Am I not importing it properly, or is there somewhere I can check to see if there is a missing .dll?

Thank you so much for your help!


Although you're importing both namespaces in the markup, you only reference System.DirectoryServices.dll. The AccountManagement part is in a separate dll.

Add another reference to web.config:

<add assembly="System.DirectoryServices.AccountManagement ...