0

My computer is on domain A, I am trying to get domain B by doing the following:

using System.DirectoryServices;
using System.DirectoryServices.ActiveDirectory;

.
.
.

DirectoryContext directoryContext = new DirectoryContext(DirectoryContextType.Domain, domainName, user, pass);
using (var domain = Domain.GetDomain(directoryContext))
{
    ...
}

When I do this Domain.GetDomain(directoryContext) throws an ActiveDirectoryObjectNotFoundException. My machine that I am running from is on a totally separate domain. The domain I am trying to connect to is a test domain. Is what I am trying to do possible? Is there some sort of network configuration that needs to be set to enable this?

Zeus82
  • 6,065
  • 9
  • 53
  • 77
  • does the Domain that you are on have `AD`..? also are you familiar with `PrincipalContext` I find it much easier to use personally.. – MethodMan Nov 09 '15 at 20:56
  • Yes it does, both domain A and B have AD. How would I do this with PrincipalContext? – Zeus82 Nov 09 '15 at 20:58
  • by doing a google search but here is a link to get you started.. http://stackoverflow.com/questions/4015407/determine-current-domain-controller-programmatically – MethodMan Nov 09 '15 at 21:07

0 Answers0