LDAP - System.NullReferenceException

This is an open forum for any mojoPortal topics that don't fall into the other categories.

This thread is closed to new posts. You must sign in to post in the forums.
6/7/2012 12:20:16 PM
Gravatar
Total Posts 1

LDAP - System.NullReferenceException

Hello

I installed mojoPortal and configure  LDAP authentication.

Make the necessary settings according to this article: http://www.mojoportal.com/usingactivedirectory.aspx

When I try to save the settings I write my domain password and I get the following error:

We're sorry but a server error has occurred while trying to process your request.

The error has been logged and will be reviewed by our staff as soon as possible. It is possible that the error was just a momentary hiccup and you may wish to use the back button and try again or go back to the home page.

Search the site log and this is what i found:

2012-06-07 12:12:04,739 ERROR 192.168.148.143 - es-ES - /Admin/SiteSettings.aspx - mojoPortal.Web.Global -  Referrer(http://192.168.148.17:81/Admin/SiteSettings.aspx) useragent Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5
System.NullReferenceException: Object reference not set to an instance of an object.
   at mojoPortal.Business.LdapUser..ctor(DirectoryEntry adentry, String userName, LdapSettings ldapSettings)
   at mojoPortal.Business.LdapHelper.ActiveDirectoryLogin(LdapSettings ldapSettings, String uid, String password)
   at mojoPortal.Business.LdapHelper.TestUser(LdapSettings ldapSettings, String uid, String password)
   at mojoPortal.Web.AdminUI.SiteSettingsPage.btnSave_Click(Object sender, EventArgs e)
   at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

 

Help Me!!

 

6/7/2012 4:12:04 PM
Gravatar
Total Posts 18439

Re: LDAP - System.NullReferenceException

Hi,

I suspect that ent variable is coming back null in the constructor where it calls ds.FindOne

I can add a null check there to prevent this error, but the real problem is it is not finding your user account in AD. Before changing to ldap you need to make sure that your loginname for the database user is identical to what will be returned from AD. 

Hope that helps,

Joe

 

7/30/2012 12:01:55 AM
Gravatar
Total Posts 68

Re: LDAP - System.NullReferenceException

Hi Joe,

I am getting the same error here with my LDAP settings as well. I have the 'Automatically Add LDAP users on first login?' on and when I tried to login with a newly created AD account I get the following error

System.NullReferenceException: Object reference not set to an instance of an object.
at mojoPortal.Business.LdapUser..ctor(DirectoryEntry adentry, String userName, LdapSettings ldapSettings)
at mojoPortal.Business.LdapHelper.ActiveDirectoryLogin(LdapSettings ldapSettings, String uid, String password)
at mojoPortal.Business.SiteUser.LoginLDAP(SiteSettings siteSettings, String loginId, String password, SiteUser& userCreatedForLdap)
at mojoPortal.Web.mojoMembershipProvider.ValidateUser(String userName, String password)
at System.Web.UI.WebControls.Login.AuthenticateUsingMembershipProvider(AuthenticateEventArgs e)
at System.Web.UI.WebControls.Login.AttemptLogin()
at System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e)
at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

What could I do here?

7/30/2012 1:26:02 PM
Gravatar
Total Posts 18439

Re: LDAP - System.NullReferenceException

I recommend upgrade to the latest version of mojoPortal.

Hope that helps,

Joe

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