directoryentry

Sorting on directorySearcher based on two properties in c#

人盡茶涼 提交于 2021-01-29 07:19:12
问题 I'm trying to get a sorted SearchResultCollection object based on department, and then by name (both alphabetical). I'm trying to load two properties, but this merely takes the last property specified and sorts it based on that. My current code is the following: DirectoryEntry entry = new DirectoryEntry(ConfigurationManager.AppSettings["LDAP"]); DirectorySearcher search = new DirectorySearcher(entry) { SearchScope = SearchScope.Subtree, Filter = "(&(objectClass=user)

The RefreshCache method not returning the complete list of tokenGroups

北城以北 提交于 2020-06-17 14:19:07
问题 I have created 2400 security groups and made a user member of all these security groups. Now I am trying to fetch all the security groups the user is member of using the DirectoryEntry.RefreshCache method. The method returns only 2050 groups. $searcher = New-Object System.DirectoryServices.DirectorySearcher($null) $searcher.SearchRoot = [ADSI]("LDAP://" + $gcName) $searcher.Filter = "((msOnline-WindowsLiveNetId=XXXXXXXX))" $searcher.PropertiesToLoad.AddRange(@("msOnline-UserPrincipalName"))

How do I query LDAP from C# to resolve Oracle TNS hostname while using managed ODP.NET?

时间秒杀一切 提交于 2020-06-10 12:44:33
问题 Further to my previous Question, which I managed to answer myself with help from the Oracle forums, I now have another issue which follows on from the earlier one (provided for background). I wish to query LDAP directly from my C# code to perform an LDAP lookup of an Oracle TNS hostname in order to get the connection string. This is normally stored in tnsnames.ora , and my organisation uses LDAP (via ldap.ora ) to resolve hostnames from an LDAP server using Active Directory. However, I am

Verify if password is correct

核能气质少年 提交于 2020-03-05 19:44:46
问题 i need to verify if the password is correct for a user. i have this code: private bool checkOldPasswordValid(string password, string username) { using (DirectoryEntry entry = new DirectoryEntry("WinNT://" + Environment.MachineName + ",computer")) { entry.Username = username; entry.Password = password; DirectorySearcher searcher = new DirectorySearcher(entry); searcher.Filter = "(objectclass=user)"; try { searcher.FindOne(); } catch (Exception ex) { return false; } return true; } } but then

Verify if password is correct

与世无争的帅哥 提交于 2020-03-05 19:43:27
问题 i need to verify if the password is correct for a user. i have this code: private bool checkOldPasswordValid(string password, string username) { using (DirectoryEntry entry = new DirectoryEntry("WinNT://" + Environment.MachineName + ",computer")) { entry.Username = username; entry.Password = password; DirectorySearcher searcher = new DirectorySearcher(entry); searcher.Filter = "(objectclass=user)"; try { searcher.FindOne(); } catch (Exception ex) { return false; } return true; } } but then

Verify if password is correct

梦想的初衷 提交于 2020-03-05 19:43:13
问题 i need to verify if the password is correct for a user. i have this code: private bool checkOldPasswordValid(string password, string username) { using (DirectoryEntry entry = new DirectoryEntry("WinNT://" + Environment.MachineName + ",computer")) { entry.Username = username; entry.Password = password; DirectorySearcher searcher = new DirectorySearcher(entry); searcher.Filter = "(objectclass=user)"; try { searcher.FindOne(); } catch (Exception ex) { return false; } return true; } } but then

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

Hash password before validate with LDAP

依然范特西╮ 提交于 2020-01-05 04:54:22
问题 I have a web-based-tool. On the login-form, the password will hashed before sending it. All fine, the database stores only hashed passwords. Now, we want a login with LDAP over DirectoryEntry . But the constructor only accepts plain passwords. My question: How can I pass hashed passwords to DirectoryEntry -class? Current method: public bool isAuthenticated(string domain, string username, string pwd) { string domainAndUsername = domain + @"\" + username; DirectoryEntry entry = new

How to provide DirectoryEntry.Exists with credentials?

萝らか妹 提交于 2020-01-03 07:17:24
问题 This morning I discovered a nice method (DirectoryEntry.Exists), that should be able to check whether an Active Directory object exists on the server. So I tried with a simple: if (DirectoryEntry.Exists(path)) {} Of course it lacks any overloads to provide credentials with it. Because, if credentials are not provided I get this Exception: Logon failure: unknown user name or bad password. (System.DirectoryServices.DirectoryServicesCOMException) Is there any other option that gives me the

how to iterate over non-English file names in PHP

筅森魡賤 提交于 2019-12-25 02:18:10
问题 I have a directory which contains several files, many of which has non-english name. I am using PHP in Windows 7. I want to list the filename and their content using PHP. Currently I am using DirectoryIterator and file_get_contents . This works for English files names but not for non-English (chinese) file names. For example, I have filenames like "एक और प्रोब्लेम.eml", "hello 鶨鶖鵨鶣鎹鎣.eml". DirectoryIterator is not able to get the filename using ->getFilename() file_get_contents is also not