directoryservices

How does InvokeMember know about the HighPart property?

回眸只為那壹抹淺笑 提交于 2020-01-25 08:54:25
问题 I want to use the System.Reflection library and not ActiveDs. I found this code on the web that parses the LargeInteger into HighPart and LowPart. I don't understand it completely, particularly where is the method 'HighPart' and 'LowPart' defined? Is that within the Object class or do I have to define it? Below is the code that parses the largeInteger: de = new DirectoryEntry(curDomain,adUser,adPwd); object largeInteger = de.Properties["maxPwdAge"].Value; System.Type type = largeInteger

Asynchronous DirectorySearcher (LDAP)

痴心易碎 提交于 2020-01-24 02:52:08
问题 I am preforming a long search in active directory and would really like to user the DirectorySearcher.Asynchronous = True. Microsoft provides very little documentation on MSDN An asynchronous search can show results as they are found while simultaneously searching for additional results. This is useful for tasks such as populating list boxes. The default setting for this property is false. How is my application to know when the search is done. I don't see any properties, events or callbacks

Move Object to an OU in Active Directory

丶灬走出姿态 提交于 2020-01-17 12:39:30
问题 I want to move a computer object to another OU I am connected to another domain and I always getting an exception of type ComException "A referral was returned from the server" and the object never move! try { //I get the exception here computerObject.MoveTo(new DirectoryEntry("LDAP://OU=someOU,OU=parentOU,DC=test,DC=com")); computerObject.CommitChanges(); } catch (InvalidOperationException inOp) { //log } catch (COMException comEx) { //log } //joinPath.Close(); finally { computerObject.Close

DirectorySearcher not working for Windows 7 64 bit or 32 bit over network

狂风中的少年 提交于 2020-01-15 12:02:38
问题 I have an application that resides on a network drive. When the program runs from an XP machine on the desktop or over the network the program works for any user. When it runs from Win 7 on the desktop it works for everyone, but when it runs from Win 7 over the network it fails for users with fewer permissions. Below is the code. It fails on the last line "Dim searchResult As SearchResult = directorySearcher.FindOne" Dim adpath As String = "LDAP://OU=orgOU,DC=ad,DC=orgDC,DC=edu" Dim

Cross Domain Authentication using DirectoryServices

大兔子大兔子 提交于 2020-01-15 06:06:27
问题 I need to create a method for my intranet web application that will authenticate a user using DirectoryServices , either against a default domain, or a user specified one. On my login form the user will be able to either give there credentials in the form of "username" and "password " or "domain\username" and "password" The first case can be used when the user is in the same domain as the webserver and is quite straightfoward. The code I use is: string domain = ""; // Code to check if the

Cross Domain Authentication using DirectoryServices

心不动则不痛 提交于 2020-01-15 06:06:14
问题 I need to create a method for my intranet web application that will authenticate a user using DirectoryServices , either against a default domain, or a user specified one. On my login form the user will be able to either give there credentials in the form of "username" and "password " or "domain\username" and "password" The first case can be used when the user is in the same domain as the webserver and is quite straightfoward. The code I use is: string domain = ""; // Code to check if the

Error with UserPrincipal.GetAuthorizationGroups() method

隐身守侯 提交于 2020-01-12 05:12:06
问题 I am having an issue using the GetAuthorizationGroups method of the UserPrincipal class in a web application. Using the following code, I am receiving "While trying to retrieve the authorization groups, an error (5) occurred" PrincipalContext context = new PrincipalContext(ContextType.Domain, null, "DC=MyCompany,DC=COM", "username", "password"); UserPrincipal p = UserPrincipal.FindByIdentity(context, IdentityType.SamAccountName, "joe.blogs"); var groups = p.GetAuthorizationGroups(); I believe

Use .Net DirectoryServices to Set TTL on Active Directory Group Membership

妖精的绣舞 提交于 2020-01-06 06:48:27
问题 I am using the tools in the .Net System.DirectoryServices.AccountManagement namespace to manage Active Directory groups - group creation, adding users to groups, removing users from group, etc. Here's some code that shows what I'm doing right now... -- group creation // connect to our organizational unit on the production Active Directory Server using (PrincipalContext principalCtx = new PrincipalContext(ContextType.Domain, s_prodAdServerName, s_ouPath)) { // create group with necessary

asp.net application userprincipal.findbyidentity works with browser on server, throws exception from my machine

前提是你 提交于 2020-01-04 15:13:53
问题 I have an application that is running on an IIS 7 server, in this program I need to find all the groups that the current user is a member of. When I access the website using the browser on the server, it works perfectly, but when I try to access it from my machine it keeps throwing a COM exception, Here is the code I'm using to get the user groups. private List<string> GetUserGroups(string userName) { //The list of strings for output. List<string> output= new List<string>(); try { //creating

Looping through DirectoryEntry or any object hierarchy - C#

依然范特西╮ 提交于 2020-01-04 14:23:10
问题 I am currently developing an application that use the System.DirectoryServices namespace to create a DirectoryEntry object and loop through the entire hierarchy to collect information. I do not know number of child entries for each DirectoryEntry object in the hierarchy, so I can not create a N number of nested loops to spiders through the Children property Here is my pseudo code example: //root directory DirectoryEntry root = new DirectoryEntry(path); if(DirectoryEntry.Childern != null) {