LDAP and Active Directory SID

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
4/16/2012 7:37:58 AM
Gravatar
Total Posts 76

LDAP and Active Directory SID

I have mojoportal as a intranet using LDAP with Active Directory.  For a feature I am working on for the specific software we use, I need the AD sid of the user that is logged in. Unfortunately, I can't get this information from the software it self (for what ever reason the database only has the SID and does a lookup with AD for the username translation).  As I don't want to fork the code, I am adding the getting of the SID in where I need it.  I have an ascx for a feature.  (For right now I have the data, business, and ui code in the same place).  I have this <%@ Import Namespace="System.DirectoryServices" %>.  The System.DirectoryServices is in the References.  These files are under the mojoPortal.Web project in its own folder.  When I use DirectoryEntry obDirEntry; it says "The type or namespace name 'DirectoryEntry' could not be found (are you missing a using directive or an assembly reference?)".

Any ideas on where to go from here?  I need to get something like "S-1-5-21-3282516150-4032899499-4205601400-2899".

Thank you for any help.

4/16/2012 11:00:58 AM
Gravatar
Total Posts 1203
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: LDAP and Active Directory SID

Do you have

using System.DirectoryServices;

at the top of your code?

4/16/2012 11:21:55 AM
Gravatar
Total Posts 18439

Re: LDAP and Active Directory SID

Your control is going to need to be in a custom project using code behind and with a post build event to copy your control up to the Web/yourfeature folder and your dll to the Web/bin folder, and in  your custom project you will need to add a reference to System.DirectoryServices in the references node of the project itself. We have no reference to that in mojoPortal.Web because we have no dependency on it. you will aslo need the using statement as Jamie said but the using statement won't work without first having the reference.

Hope that helps,

Joe

4/16/2012 3:32:01 PM
Gravatar
Total Posts 76

Re: LDAP and Active Directory SID

Thank you for both of your quick responses. The page is using inline code. Right now, I am developing my custom add-ons directly inside the web/yourfeature folder. And until I get where its polished enough to share, I will do a custom project. Something that is confusing me. I am able to use the namespace System.Data. For some reason I can't use the namespace "System.DirectoryServices". If I can't get this to work, my other idea is to get some kind of code that when the person logs in will update a read only user profile property (or do it by hand).

4/16/2012 6:51:39 PM
Gravatar
Total Posts 1203
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: LDAP and Active Directory SID

Hi Jonathan, I just pulled up the source code for my User Registered Event Handler that auto-assigns role(s) to newly created AD users. The using statement I have is:

using System.DirectoryServices.AccountManagement;

I hope that helps,

Jamie

You must sign in to post in the forums. This thread is closed to new posts.