SqlMembershipProvider vs DbMembershipProvider and single sign on

Topics: Business Logic Layer
Jan 7, 2014 at 7:04 AM
Edited Jan 8, 2014 at 4:22 AM
Thanks in advance.
I have an existing website that uses System.Web.Security.SqlMembershipProvider and System.Web.Security.SqlRoleProvider for authentication and authorization. Because of single sign on I am using the same provider for blog engine. But because of that I am not using be_users table and be_UserRoles table. Therefore I believe that is why all my users will show up on all blogs. Is this expected behavior? Any way to get around it? I need single sign on and limit user to certain blogs.

Seems like I have to switch my current application to use DbMembershipProvider and DbRoleProvider is the only option? I tried this but get "Parser Error Message: The type initializer for 'BlogEngine.Core.Utils' threw an exception." on

<add name="DbMembershipProvider" type="BlogEngine.Core.Providers.DbMembershipProvider, BlogEngine.Core" passwordFormat="Hashed" connectionStringName="MyConnection"/>

Thank you!
QZ
Jan 9, 2014 at 1:15 AM
I got DbMembershipProvider working and here is what you have to do. Copy the following section from blogengine web.config and merge into exist web.config
I am using version 2.8.

<configSections>
<sectionGroup name="BlogEngine">
  <section name="blogProvider" requirePermission="false" type="BlogEngine.Core.Providers.BlogProviderSection, BlogEngine.Core" allowDefinition="MachineToApplication" restartOnExternalChanges="true"/>
  <section name="blogFileSystemProvider" requirePermission="false" type="BlogEngine.Core.Providers.BlogFileSystemProviderSection, BlogEngine.Core" allowDefinition="MachineToApplication" restartOnExternalChanges="true"/>
</sectionGroup>
</configSections>
<BlogEngine>
<blogProvider defaultProvider="DbBlogProvider" fileStoreProvider="XmlBlogProvider">
  <providers>
    <add description="Xml Blog Provider" name="XmlBlogProvider" type="BlogEngine.Core.Providers.XmlBlogProvider, BlogEngine.Core"/>
    <add connectionStringName="RealtyTrendsTransDB" description="Sql Database Provider" name="DbBlogProvider" type="BlogEngine.Core.Providers.DbBlogProvider, BlogEngine.Core"/>
  </providers>
</blogProvider>
<blogFileSystemProvider defaultProvider="XmlBlogProvider">
  <providers>
    <add description="Xml Blog Provider" name="XmlBlogProvider" type="BlogEngine.Core.Providers.XmlFileSystemProvider, BlogEngine.Core"/>
    <add storageVariable="BlogEngine" description="Sql Database Provider" name="DbBlogProvider" type="BlogEngine.Core.Providers.DbFileSystemProvider, BlogEngine.Core"/>
    <!--<add storageVariable="\\UNCPath\BlogFiles" description="UNC Path Provider" name="UNCBlogProvider" type="BlogEngine.Core.Providers.UNCFileSystemProvider, BlogEngine.Core" />-->
  </providers>
</blogFileSystemProvider>
</BlogEngine>

the second part is to copy the following into your web.config.
<add key="BlogEngine.MobileDevices" value="(iemobile|iphone|ipod|android|nokia|sonyericsson|blackberry|samsung|sec\-|windows ce|motorola|mot\-|up.b|midp\-)"/>