Current Multi-blog enabling LINQ to SQL BlogEngine.NET Provider. (Updated 3/12/10)

I have been asked for this code so that we can share the multi-blog solution that has been working for me for almost a year now.  This is the time to check it out and help make it work for yourself and others.  I’m going to continue to “dog food” this here.  Current version of BlogEngine.NET supported by this provider, as of this post, is  Although I need to update my own site(s) from


How will I update?

Mine is easy.  Drop in the new DLLs.

If I do a code “diff” and find the Web code to have changed recently (which I’m sure it did) I will copy those specific files to the Web folder.


How do you update from a clean BlogEngine.NET code base?
  1. You should download the latest BE.NET code from codeplex and create a folder for the solution. 
  2. Extract the code from the zip into your solution folder. (…and follow the directions for setting up a stand-alone SQL Server Blog)
  3. Copy and unzip the folder into the solution folder with the Core and Web projects.
  4. Add an existing Project to the solution, select the BlogEngine.Linq2Sql project.
  5. Verify the References (to project “BlogEngine.Core”)
  6. Add a reference to “BlogEngine.Linq2SQL” from the “BlogEngine.NET” Web site.
  7. Change Target Framework on BlogEngine.NET Web site to “.NET Framework 3.5
  8. Execute the SQL build script “Linq2SqlUpdate.sql” to add schema to support Multi-Blogs.
    • Make sure to run against the Database you created in Step 2.
  9. Assuming you are using the correct connection string, modify the Web.Config
    • blogProvider, membership, roleManager
    • See: Web.Config.xml

For those who like pictures to verify what you're doing, here are a couple.  I'd rather have an installer but I'm not quite there yet.

Step 3:


Step 4:

Step4a Step4b Step4c

Step 5:


Step 6:

Step6 Step6b

Step 7:


Step 9:

    1: <BlogEngine>
    2: <blogProvider defaultProvider="Linq2SqlBlogProvider">
    3: <providers>
    4: <add name="Linq2SqlBlogProvider" type="BlogEngine.Linq2SQL.Linq2SqlBlogProvider, BlogEngine.Linq2SQL" connectionStringName="BlogEngine"/>
    5: <add name="XmlBlogProvider" type="BlogEngine.Core.Providers.XmlBlogProvider, BlogEngine.Core"/>
    6: <add name="DbBlogProvider" type="BlogEngine.Core.Providers.DbBlogProvider, BlogEngine.Core" connectionStringName="BlogEngine"/>
    7: </providers>
    8: </blogProvider>
    9: </BlogEngine>
    12: <membership defaultProvider="LinqMembershipProvider">
    13: <providers>
    14: <clear/>
    15: <add name="LinqMembershipProvider" type="BlogEngine.Linq2SQL.LinqMembershipProvider, BlogEngine.Linq2SQL" passwordFormat="Hashed" connectionStringName="BlogEngine"/>
    16: <add name="XmlMembershipProvider" type="BlogEngine.Core.Providers.XmlMembershipProvider, BlogEngine.Core" description="XML membership provider" passwordFormat="Hashed"/>
    17: <add name="SqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="BlogEngine" applicationName="BlogEngine"/>
    18: <add name="DbMembershipProvider" type="BlogEngine.Core.Providers.DbMembershipProvider, BlogEngine.Core" passwordFormat="Hashed" connectionStringName="BlogEngine"/>
    19: </providers>
    20: </membership>
    21: <roleManager defaultProvider="LinqRoleProvider" enabled="true" cacheRolesInCookie="true" cookieName=".BLOGENGINEROLES">
    22: <providers>
    23: <clear/>
    24: <add name="LinqRoleProvider" type="BlogEngine.Linq2SQL.LinqRoleProvider, BlogEngine.Linq2SQL" connectionStringName="BlogEngine"/>
    25: <add name="XmlRoleProvider" type="BlogEngine.Core.Providers.XmlRoleProvider, BlogEngine.Core" description="XML role provider"/>
    26: <add name="SqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="BlogEngine" applicationName="BlogEngine"/>
    27: <add name="DbRoleProvider" type="BlogEngine.Core.Providers.DbRoleProvider, BlogEngine.Core" connectionStringName="BlogEngine"/>
    28: </providers>
    29: </roleManager>

This is what you see when attempting to rate a new post. Click on a Star to rate the post.  Notice the infinitesimally small rating that is generally added when creating a first post.  This may be something I did myself while trying to “fix” the Add a new Blog script.



These are the symptoms I could find so far, but I cannot isolate the DateTime property that is causing the Exception.

Line number (approximate:)


SqlTypeException without enough detail for me to locate the offending data point.  What am I missing?


For more information on this Project:  I will update this post when a resolution is found.


DateTime Format for Blog Posts for BlogEngine.NET

...or wherever you want to standardize output formatting.

Here is a rather simple solution to my issue of Date Time formatting on my blog posts.  I noticed that as of a recent version of BlogEngine.NET, the Date looked something like this: "29. June 2008 09:00"  I wanted to change it to something more readable to my target readers, some very local, such as: "Sunday, June 29, 2008 09:00 AM".  Well, I might want to change it sometime, AND I would like to drop it into multiple Themes, so I decided to place the format in Web.Config AppSettings. I looked up my specific Format and added an appSetting.  Then I just replaced the code used in "PostView.ascx" and tested away.

Here's what you can do to implement this yourself.

  1. Go to .NET Framework Developer's Guide, Custom Date and Time Format Strings and/or locate your format string.
    • I used "dddd, MMMM dd, yyyy hh:mm tt"
  2. Create an appSettings key such as: Custom.DateFormat and assign your format to the value.
    • <add key="Custom.DateFormat" value="dddd, MMMM dd, yyyy hh:mm tt" />
  3. Now add the code to use the format string.
    • <%=Post.DateCreated.ToString(ConfigurationSettings.AppSettings["Custom.DateFormat"])%>
    • original: <%=Post.DateCreated.ToString("d. MMMM yyyy HH:mm") %>


This is what it looks like:

Web.Config ...

    <add key="Custom.DateFormat" value="dddd, MMMM dd, yyyy hh:mm tt" />

PostView.ascx ...

    <span class="author">by <a href="<%=VirtualPathUtility.ToAbsolute(" mce_href="<%=VirtualPathUtility.ToAbsolute("~/") + "author/" + Post.Author %>.aspx"><%=Post.AuthorProfile != null ? Post.AuthorProfile.DisplayName : Post.Author %></a></span>
    <span class="pubDate"><%=Post.DateCreated.ToString(ConfigurationSettings.AppSettings["Custom.DateFormat"])%></span>



You can add appSettings directly in Web.config, from IIS Manager, if ASP.NET configuration is available, or from "ASP.NET Web Site Administration Tool".  Although this solution was quick and dirty, the best answer may be to role localization into BlogEngine.NET using cultures.  This is not a specialty of mine so I would appreciate any suggestions on this topic.  It is likely only a few more lines of code for a "quick and dirty" approach but I'd rather make sure to do it right.

TVUG Presentation - June 10th, 2008 (Now June 17th)  

This event was postponed due to serious weather advisories.

Be sure to check the TVUG Website for any updates.

TVUG President wrote in an e-mail to the Tech Valley .NET Users Group membership.  Please join us...

Join us for our last meeting before our summer break as Andrew Badera introduces us to Windows Communication Foundation. The current plan is that we won't have another meeting until September '08, but we might have a special meeting if we can get an INETA speaker in the area. Let's put it to a vote next week!

WCF Essentials

Speaker: Andrew Badera, CTO, Change Round-Up
When: Tuesday June 10th, 2008 - 6:30-9PM
Where: VersaTrans Solutions, Latham, NY

The global acceptance of Web services, which includes standard protocols for application-to-application communication, has changed software development. Windows Communication Foundation (WCF) is designed to offer a manageable approach to distributed computing, broad interoperability, and direct support for service orientation.

In order to simplify development of connected applications through a service-oriented programming model, Windows Communication Foundation bundles a lot of powerful features in one easily configured package. A couple notable features, as service architectures grow more complex and support greater workload, are duplex communication and connection throttling. This presentation will review the essentials of WCF, utilizing a Silverlight GUI to demonstrate latency and scaling characteristics of a simplex polling application vs. a duplex push application.

Speaker Bio
A lifelong geek, Andrew Badera has been immersed in the software world since the age of seven, when his parents bought him a Tandy BASICA programming book instead of Chuck Yeager's Advanced Flight Simulator he had been asking for, months on end. Not to be dissuaded, he read the book three times over the following week, and immediately set about, without any great degree of success, trying to write his own flight simulator. Currently he serves as CTO of Change Round-Up in Coxsackie, NY as well as senior software engineer on the Open Systems team at Davis Vision, Inc. in Latham.

The move is finally under way.  App hosting is a fading memory and now I'm getting back to what I know...the details.  A VPS server from 1and1 (and the 50% off discount for the first 3 months) is what saved me from dropping the whole idea of internet hosting.  I was frustrated at trying to write simple ASP.NET apps or even using proven work and finding out there was to be MUCH more time spent at configuration and troubleshooting than design and coding.

Tools need to be made much simpler for end users to do a specific task, but I need full control.  I once used a hosted server solution, which worked well for what I needed, until it became a financial burden.  The hobby wasn't paying me back anymore and I had no real need for the service so I opted for, what I believed to be, the simpler solution in web site and ASP.NET hosting.  Now that I had discovered the error in my ways, I’m back to building my empire.

Blogging should be the start of a process that will include tutorials, training, knowledge sharing, and collaboration.  I’ll embellish as time permits.  Thanks for reading.