XML cusomter membership provider type c#
-
19-04-2021 - |
Question
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'.
La solution
The type string should also include the assembly name that contains the XmlMembershipProvider.
<add name="..." type="XmlMembershipprovider, MyAssembly" .../>
Autres conseils
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.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow