|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
![]() Hi All, Please help. How to retrieve groups from username by using asp.net ? My ldap server is domino ldap server. Thank you very much. |
#2
| |||
| |||
Re: Get dominoGroup from username by using asp.net For that you need to put the following code, whenever you log from username by using asp.net. If you need to when the page first loads, the you can do this in the Page_Load or Page_Init Events Quote:
|
#3
| |||
| |||
Re: Get dominoGroup from username by using asp.net Hi Modifier, Thanks for your help first. I mean that finding domino groups of logged in user. e.g. Searched by kelvin Group List ----------- IT Department I found simlar source code, but it doesn't work. StringCollection groups = new StringCollection(); DirectorySearcher srch = new DirectorySearcher(RootDirectoryEntry,"(sAMAccountName=" + strUser + ")"); // set properties to retrieve srch.PropertiesToLoad.Add("memberOf"); srch.PropertiesToLoad.Add("sAMAccountName"); // find one entry since there should be no duplicates of sam account name // in the active directory SearchResult res = srch.FindOne(); // clear the groups collection for safe measure groups.Clear(); // get the number of groups that the user is a member of int propertyCount = res.Properties["memberOf"].Count; // create some variables for the looping through groups String dn; int equalsIndex, commaIndex; // loop through groups for( int propertyCounter = 0; propertyCounter < propertyCount; propertyCounter++) { dn = (String)res.Properties["memberOf"][propertyCounter]; // the following is used to remove the cn= etc... equalsIndex = dn.IndexOf("=", 1); commaIndex = dn.IndexOf(",", 1); if (-1 == equalsIndex) { } else { // add string to group collection groups.Add(dn.Substring((equalsIndex + 1),(commaIndex - equalsIndex) - 1)); } } |
#4
| |||
| |||
Re: Finding domino groups of logged in user by using asp.net Hi All, Here is attached my source code, I try to pass administrator or user account, but the error message shown "Accessed Denied". ldappath = "LDAP://192.168.1.10" Dim MyDirectory As DirectoryEntry MyDirectory = New DirectoryEntry(ldappath, txtUsername, txtPassword, AuthenticationTypes.None) Dim groups As StringCollection = New StringCollection() Dim srch As DirectorySearcher = New DirectorySearcher(MyDirectory, "(&(givenName=" + txtUsername + "))") srch.PropertiesToLoad.Add("memberOf") srch.PropertiesToLoad.Add("givenName") srch.SearchScope = SearchScope.Subtree Dim res As SearchResult = srch.FindOne() groups.Clear() Dim propertyCount As Integer = res.Properties("memberOf").Count Dim dn As String Dim equalsIndex, commaIndex As Integer For propertyCounter As Integer = 0 To propertyCounter < propertyCount dn = res.Properties("memberOf")(propertyCounter).ToString equalsIndex = dn.IndexOf("=", 1) commaIndex = dn.IndexOf(",", 1) If (-1 = equalsIndex) Then Else groups.Add(dn.Substring((equalsIndex + 1), (commaIndex - equalsIndex) - 1)) End If Next |
#5
| |||
| |||
Re: Get dominoGroup from username by using asp.net Hi, I have similar problem & I used WindowsTokenRoleProvider & I could find out my username & got all the Groups I belong on my system. CAn I do the same but against active directory? Do I need to use "AuthorizationStoreRoleProvider"? & install azman? |
![]() |
|
Tags: dominogroup |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to Get Current Username in VB.NET | Samir_1 | Software Development | 4 | 13-03-2014 11:43 AM |
Every process is without username | Erakna | Operating Systems | 6 | 05-08-2011 03:10 PM |
Need help for getting the DSL username and password | Road-Runner | Networking & Security | 4 | 03-12-2010 05:18 PM |
How to change facebook username | Harvey | Technology & Internet | 3 | 11-09-2009 06:46 PM |
SID not resolving to Username | Nadeem | Active Directory | 5 | 05-01-2009 06:26 PM |