Thank you for your reply. I learn more and more every time I dive into the code. For the active directory, would it be possible to use System.DirectoryServices instead of Novell.Directory.Ldap to pull information about the user? I am not sure how MojoPortal is authenticating the user, so I when I did my test on System.DirectoryServices I entered my credentials manually in the code below. It pulls up information about other users (the public information about them. My login is not a domain admin). Also in my test, I put everything to a label to see it. If MojoPortal can gain access to the same entry type, it can not only pull information about the user (name, email), but also pull the groups they are in and if the setting is turned on (one way, two way, etc), synch the groups to the matching internal groups. (Feature Request I am willing to help with once I understand more about the login procedure).
Warning: Sloppy code ahead:
using System.DirectoryServices;
public void ad(string user)
{
DirectoryEntry Entry = new DirectoryEntry("LDAP://domain.com", "myusername", "password");
DirectorySearcher Searcher = new DirectorySearcher(Entry);
System.DirectoryServices.SearchResult result = default(System.DirectoryServices.SearchResult);
try
{
Searcher.Filter = ("(anr=" + user + ")");
result = Searcher.FindOne();
// Get the properties for 'mySearchResult'.
ResultPropertyCollection myResultPropColl = default(ResultPropertyCollection);
myResultPropColl = result.Properties;
string myKey = null;
bool usekey = false;
foreach (string myKey_loopVariable in myResultPropColl.PropertyNames)
{
myKey = myKey_loopVariable;
usekey = true;
switch (Strings.LCase(myKey))
{
case "cn":
break;
case "mail":
break;
case "samaccountname":
break;
case "givenname":
break;
case "sn":
break;
default:
usekey = false;
break;
}
if (usekey)
{
object myCollection = null;
if (myResultPropColl(myKey).Count > 0)
{
o.Text += "<br>" + myKey + ": " + myResultPropColl(myKey).Item(0);
}
else
{
//handle default here
}
}
}
}
catch (Exception ex)
{
string debug = ex.Message;
}
}
Bottom line, do you think its possible to include some of this code in the way mojoPortal authenticates users with ldap settings?