BlogEngine.NET Screencast: SQL Membership and Roles Providers

SQLMembership The third screencast in my recent series is a walk through of setting up the SQL Membership and Roles providers in place of the default XML versions.  These SQL providers are built-in to the .NET 2.0 framework and are not BlogEngine.NET components.  BlogEngine.NET was designed to allow using these providers however and is fully supported.

This screencast is a bit longer than the previous two as I start without the membership and roles services in a database and walk you through creating these, checking permissions, setting up your web.config to use them and adding your initial roles and users in the database.

As before, it is available in both an in page flash version and Windows Media Video format.

Here is the web.config updates (for those interested):

[code:xml]

<membership defaultProvider="SqlMembershipProvider" >
      <providers>
        <clear />
        <add name="XmlMembershipProvider"
             type="BlogEngine.Core.Providers.XmlMembershipProvider, BlogEngine.Core"
             description="XML membership provider"
             xmlFileName="~/App_Data/users.xml"/>
        <add name="SqlMembershipProvider"
             type="System.Web.Security.SqlMembershipProvider"
             connectionStringName="BlogEngine"
             applicationName = "BlogEngine"/>
      </providers>
    </membership>

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

[/code]

I stress in the screencast, these are the basic entries and lots of options could be added in.  These will get you on the right track however.

In case you missed it above, the links to the screencasts are here:

    <li><a href="/misc/BE13SQLMembership.html">Flash version</a> </li>    
    <li><a href="/misc/BE13SQLMembership.wmv" onclick="javascript:urchinTracker ('/downloads/map'); ">Windows Media Video format</a> </li>