ActiveDirectoryMembershipProvider Object reference not set ...

J

JD Qixcle

The following message was originally posted to
microsoft.public.dotnet.framework.aspnet

....

I have been following several threads between David Thielen and Luke Zhang
[MSFT] regarding the ActiveDirectoryMembershipProvider as used for ASP.NET
2.0 Forms authentication, but I receive a slighly different error. I
consistently receive the following message after submitting credentials from
the login page:

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

Source Error:

Line 30: <providers>
Line 31: <add name="ActiveDirectoryProvider"
Line 32: type="System.Web.Security.ActiveDirectoryMembershipProvider,
System.Web, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"
Line 33: connectionStringName="ADService"
Line 34: attributeMapUsername="samAccountName"


This is not the "The specified connection
string does not represent a valid LDAP adspath." issue. I can solve that
with a valid ADSI path as follows:

<connectionStrings>
<add name="ADService" connectionString="LDAP://my.domain.com"/>
</connectionStrings>

From IIS 5 on XP SP2, I initially had trouble with invalid username or
password errors. These coule be solved by supplying the connectionUsername
and connectionPassword settings. On IIS6 from Windows 2003, the application
pool uses a Network Service account in the same domain in the LDAP setting so
I have no problems on that platform.

I can't help but think there is a simple solution to this, but so far I
missing something. I have already looked through several Microsoft articles
including the following:

Explained: Forms Authentication in ASP.NET 2.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/PAGExplained0001.asp

How To: Use Forms Authentication with Active Directory in ASP.NET 2.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/paght000026.asp

ActiveDirectoryMembershipProvider Clas
http://msdn2.microsoft.com/en-us/library/system.web.security.activedirectorymembershipprovider.aspx

ScottGu's Blog: ASP.NET 2.0 Membership, Roles, Forms Authentication, and
Security Resources
http://weblogs.asp.net/scottgu/archive/2006/02/24/438953.aspx

Any ideas or suggestions will be appreciated.
 
J

JD Qixcle

I would like to be able to use Forms Authentication to allow our Windows
users to access several web applications on kiosk machines and I cannot use
Windows Authentication. Using the SqlServerMembership provider would add a
layer of additional management since we already have AD user accounts and
groups to cover our needs within the web application. Unfortunately, we have
not be successful in implementing the ActiveDirectoryMembershipProvider.

Here are the relevent sections of the web.config for our environment...

<add name="ADService"
connectionString="LDAP://my.domain.com/DC=my,DC=domain,DC=com"/>
</connectionStrings>

<membership defaultProvider="ActiveDirectoryProvider">
<providers>
<add
name="ActiveDirectoryProvider"
type="System.Web.Security.ActiveDirectoryMembershipProvider
, System.Web, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="ADService"
attributeMapUsername="SAMAccountName"
connectionUsername="domain\username"
connectionPassword="##password##"
enableSearchMethods="true"
connectionProtection="None"
/>
</providers>


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

Source Error:

Line 30: <providers>
Line 31: <add name="ActiveDirectoryProvider"
Line 32: type="System.Web.Security.ActiveDirectoryMembershipProvider,
System.Web, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"
Line 33: connectionStringName="ADService"
Line 34: attributeMapUsername="samAccountName"

If I try to handle the onAuthenticate event, I can get additional stack
trace information the first time I try to use the Membership object...

at
System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings
providerSettings, Type providerType)
at
System.Web.Configuration.ProvidersHelper.InstantiateProviders(ProviderSettingsCollection configProviders, ProviderCollection providers, Type providerType)
at System.Web.Security.Membership.Initialize()
at System.Web.Security.Membership.get_Provider()
at System.Web.Security.Membership.get_ApplicationName()

I sense that I am missing something in the web.config, or there is something
wrong with the case of one of the attributes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top