This project is read-only.

Using BlogEngine within an internal web service which already has a log-in system

Dec 22, 2010 at 1:55 AM

Hi :) We're making an internal web service written in C# and ASP.NET for our company, so that employees can log in and do all sorts of various functions relevant to the company, such as view and interact with a shared calendar, review logs of client visits, and so on.  We've got this all up and running, but one of the next things we want to implement is a "news" section using an ASP.NET blogging software.  BlogEngine.NET was the first thing to come up, and it seems promising.  But I need to ask two questions to make sure that this is indeed the software we want to use:

1) The service we have already created with the above-mentioned features already requires a log-in.  And we want to implement BlogEngine.NET *within* that service.  However, looking briefly at the installation documentation and whatnot, it appears that BlogEngine.NET uses a log-in system itself.  What we want to happen is, when a person logs into our service, they are immediately able to make a blog post under their username/password used for the overall service, and not have to log-in as a separate entity just to use the BlogEngine.NET blog.  Possible?  Thoughts?  Our log-in credentials are stored in an SQL database, if that makes any difference.

2) What we're envisioning is, if you want to make a post, you have to go to some kind of "make a blog post" page.  But what we want is for the latest post TITLES to appear at the top of the main masterpage as just headlines (perhaps the latest 3 entries), and if you click them, they will take you to the post.  Also, based on the tag of a post, we want the post to appear in different parts of the service.  So for example, let's say we have two types of blog entries: pieces of news, and developer notes.  If someone makes a post and chooses "news" as the tag, that post appears on the news.aspx page and no where else.  If someone makes a post and chooses "development" as the tag, that post appears in the development.aspx page and no where else.  Is this kind of flexibility and customization available straight out of the box?


Dec 22, 2010 at 8:20 AM

Hi.  BE (BlogEngine) uses the ASP.NET Membership provider system.  By default it uses its own XML provider -- a provider that plugs into the ASP.NET membership provider system.  The XML provider stores users & roles in the App_Data folder.  BE also includes a DB membership provider that stores users and roles in a SQL DB -- in 2 tables, be_Users and be_Roles.  You can also use the standard SqlMembershipProvider with BE, where users/roles are stored in a SQL DB -- in the tables that have names beginning with "aspnet_".

For your specific scenario, you could customize BE (without too much work) so it looks for an authenticated login from your current system, and if found, can treat that as as a valid login within BE.  There's several ways this could be done.  It could look for a cookie that your current system creates ... for example, as discussed here, if the Machine Key is the same between BE and your other system and that current system is using ASP.NET Forms Authentication, most likely it can be setup so BE recognizes that login cookie.  Actually, in this latter scenario, this could probably be accomplished without any code changes ... by just making sure the Machine Key in the two web.config files matches ... and BE would automatically recognize the login from the current system.

For #2, there are URLs that will display all posts from a specific category or tag.  A category URL looks like:

A tag URL looks like:

The blog posts are stored in memory and easily accessible for customized output.  So you could easily create code, or even a widget that displays headlines only of the latest 3 entries.  There's actually already a Recent Posts widget that basically does this.  If it's not exactly what you're looking for, the widget could be adjusted to work differently.

Fortunately, it's a pretty small learning curve to understand how to take the data (Posts, tags, categories) and output them how you'd like.