XML cusomter membership provider type c#

491 views Asked by At

Here is my class declaration:

public class XmlMembershipProvider : MembershipProvider
    {....}

and my web.config snipit:

<membership defaultProvider="CustomXmlMembershipProvider">
            <providers>
        <add name ="CustomXmlMembershipProvider" type="XmlMembershipProvider" xmlFilePath="App_Data\Userstore.xml"/> .....

I am not sure what to do from this point. I have done a ton of google searching but cannot find out why I am getting the following error:

Parser Error Message: Could not load type 'XmlMembershipProvider'.
2

There are 2 answers

1
Richard Schneider On BEST ANSWER

The type string should also include the assembly name that contains the XmlMembershipProvider.

 <add name="..." type="XmlMembershipprovider, MyAssembly" .../>
0
Stanley On

Only adding the reference to the assembly (as below) still gave errors, although it is a step in the right direction:

<add name="..." type="XmlMembershipprovider, MyAssembly" .../>

I found that the fully qualified reference to the assembly should ALSO be added as follows:

<add name="..." type="MyAssembly.XmlMembershipprovider, MyAssembly" .../>

Now it works.