Using XmlMembership and Role provider in other site

Topics: ASP.NET 2.0
Jan 16, 2008 at 1:20 AM
Hi, I want user/passw requirement in some website but I don't want to be complicated with SQL installation(and also paying for that to hosting) instead I want to use the XMLMembershipProvider and XMLRoleProvider that use BlogEngine..
Trying to do that I included BlogEngine.Core.dll, .pdb and .XML files in my bin directory, the user.xml and roles.xml in App_Data, also I included the following lines below my web.config

validation="SHA1" decryption="AES"

<authentication mode="Forms">
<forms timeout="129600" name=".AUXBLOGENGINE" protection="All" slidingExpiration="true" loginUrl="~/Page/login.aspx" cookieless="UseCookies" />

<membership defaultProvider="XmlMembershipProvider" >
<clear />
<add name="XmlMembershipProvider" type="BlogEngine.Core.Providers.XmlMembershipProvider, BlogEngine.Core" description="XML membership provider" xmlFileName="~/App_Data/users.xml"/>

<roleManager defaultProvider="XmlRoleProvider" enabled="true" cacheRolesInCookie="true" cookieName=".BLOGENGINEROLES">
<clear />
<add name="XmlRoleProvider" type="BlogEngine.Core.Providers.XmlRoleProvider, BlogEngine.Core" description="XML role provider" xmlFileName="~/App_Data/roles.xml"/>

but when I run the website I get the following error:

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

Source Error:

Line 48: <providers>
Line 49: <clear />
Line 50: <add name="XmlRoleProvider" type="BlogEngine.Core.Providers.XmlRoleProvider" description="XML role provider" xmlFileName="~/App_Data/roles.xml"/>
Line 51: </providers>
Line 52: </roleManager>

Source File: C:\xxxxxxxxxx\web.config Line: 50

What I'm doing wrong ???

Thanks in advance.
Jan 16, 2008 at 4:40 PM
Have a look at these articles for some assistance... I would also encourage you to have a look at these articles for securing your authentication using SSL
Jan 16, 2008 at 10:45 PM
Thanks a lot. Perfect !!! Tha's exactly what I was looking for.. and very clear article.