views:

292

answers:

2

Hi there,

I was trying to implement a custom membership provider, everything goes well, I can connect, I can change user details, but as soon as I create user, I got this error when it tries to get the user after I complete create a user.

The error is coming from my web.config, it is saying it's a ConfigurationErrorsException, and it also says that the problem is on my type under the config file, I am sure that the provider type I provided is correct, such as

type="MyNamespace.MyCustomMembershipProvider"

Please help me

Thanks

+3  A: 

When you put the type in, you need to specify the assembly it comes from.

So MyNamespace.MyCustomMembershipProvider in MyNamespace.dll, would require this configuration:

type="MyNamespace.MyCustomMembershipProvider, MyNamespace"

Also, in case it's complaining about the default provider, either name your default provider as SqlAspNetMembershipProvider (in the XML, not the classname) or set the default provider name on the "membership" element in your web.config.

This is how mine looks:

<membership defaultProvider="SqlMembershipProvider">
    <providers>
     <clear/>
     <add name="SqlMembershipProvider" 
       type="Barnwell.Web.Security.SqlMembershipProvider, Barnwell.Web.Security" 
     ... />
Neil Barnwell
A: 

Without seeing the implementation, most likely you have a problem in your CreateUser method of your custom membership provider. Follow the link for more information;

http://msdn.microsoft.com/en-us/library/system.web.security.membershipprovider.createuser.aspx

Xian