+1-888-365-2779
Try Now
More in this section

Forums / Set-up & Installation / Null reference with Active Directory provider

Null reference with Active Directory provider

3 posts, 1 answered
  1. Christian Ecker
    Christian  Ecker avatar
    7 posts
    Registered:
    08 Mar 2010
    19 May 2010
    Link to this post
    Hi,

    I've tried to set up the Active Directory providers on our install, but am getting a configuration error in the web.config file.  The highlighted line is the type attribute in the add tag for the role provider:

    Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

    Parser Error Message: Object reference not set to an instance of an object.

    Source Error:

    Line 119:			  groupDefinitionFilter="(objectClass=group)"
    Line 120:			  connectionStringName="ActiveDirectory"
    Line 121:			  type="Telerik.Security.ActiveDirectory.TelerikADRoleProvider, Telerik.Security"
    

    Further stack trace information is commented at the bottom of the served HTML page:

    <!-- 
    [ConfigurationErrorsException]: Object reference not set to an instance of an object. (C:\Program Files (x86)\telerik\Sitefinity3.7\WebSites\Test\web.config line 121)
       at System.Web.Security.Roles.Initialize()
       at System.Web.Security.RoleManagerModule.OnLeave(Object source, EventArgs eventArgs)
       at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
       at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
    -->

    I believe I have everything configured as specified in the documentation.  The only other stumbling point I had was that I needed to escape the ampersands in the LDAP filter strings by using &amp;  before that I was getting a 500 error.

    Any suggestions on why I am getting this null reference, or how I could go about further debugging it?

    Thanks
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    19 May 2010
    Link to this post
    Hi Christian Ecker,

    The error is thrown on the initialization of AD role provider

    You need to replace the type of the role provider with ADRoleProviderTest. Put the code below in App_Code folder and clear the error log before starting. This should help you to track the error and figure out what is going wrong.

    using System;
    using System.Collections.Generic;
    using System.Web;
    using Telerik.Security.ActiveDirectory;
    using Telerik.Utilities;
      
    public class ADRoleProviderTest : TelerikADRoleProvider
    {
        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
        {
            try
            {
                base.Initialize(name, config);
            }
            catch (Exception err)
            {
                Log.Exception(
                    this
                    String.Concat("ADRoleProviderTest error: ", err.Message), 
                    err);
                throw err;
            }
        }
    }

    The problem could be some permission issue. Check whether roleManager is enabled. There could be some problem with the RolePrincipal instance for the current user. The problem seems to be related to your AD setup, because our code pass and the error is thrown in classes from System.Web.dll

    All the best,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
    Answered
  3. Christian Ecker
    Christian  Ecker avatar
    7 posts
    Registered:
    08 Mar 2010
    19 May 2010
    Link to this post
    It turns out I had cased the attribute 'connectionUsername' improperly as 'connectionUserName'.  Thanks for your help, Ivan!
Register for webinar
3 posts, 1 answered