Using ConfigurableActiveDirectoryMembershipProvide

2019-08-13 01:08发布

问题:

I want to use ConfigurableActiveDirectoryMembershipProvider in my code. I have my current settings as

<add name="XXXXMembershipProvider" 
     type="System.Web.Security.ActiveDirectoryMembershi pProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"       
     connectionStringName="XXXXConnectionString"     
     connectionUsername="user"
     connectionPassword="password"
     connectionProtection="Secure" />

I have changed this to

<add connectionStringName="" 
     name="XXXXDomainADMembershipProvider" 
     type="Spring.Web.Providers.MembershipProviderAdapter, Spring.Web" />

and added in to my spring config file as

<object id="XXXXDomainADMembershipProvider" 
        type="Spring.Web.Providers.ConfigurableActiveDirec toryMembershipProvider">
    <property name="connectionStringName" value="XXXXDomainConnectionString" />
    <property name="connectionUsername" value="user" />
    <property name="connectionPassword" value="password" /> 
</object>

But I am getting the following error

Error creating context 'spring.root': Could not load type from string value 'Spring.Web.Providers.ConfigurableActiveDirectoryM embershipProvider'.

I checked the Spring.WebQuickStart source code and the class Spring.Web.Providers.ConfigurableActiveDirectoryMembershipProvider has been commented out.

Is that the reason I am getting the above error?

回答1:

Yes, I think you are correct. The error you are getting is exactly the error Spring returns when you are trying to configure an object using a type that can not be loaded. For instance if the class does not exist at all, which appears to be the case here.

You can double check if the ConfigurableActiveDirectoryMembershipProvider class exists by using the object browser to explore the Spring.Web.Providers namespace in the Spring.Web assembly you are using in your project.

You are right that the class is commented out in the current state of the trunk code. It has a small TBD note, so I think they are not sure if they want to implement this. But it could be that it wasn't commented out in the version of Spring.Web you are using, so you should still check it using the object explorer.

Strangely enough, the ConfigurableActiveDirectoryMembershipProvideris mentioned in the documentation - you might want to post this on the Spring.Net forum they're likely to help you.