Stuck while adding multi-blog capability

Topics: Business Logic Layer
Jan 13, 2008 at 12:14 PM
I'm modifying this product so that I can support mutliple blogs on a single installation, and I've run into a big of a snag, so I'm hoping that some people here can point me out of it.

There seems to be only one copy of the Posts List (a collection of all of the posts) on the server - it's static. In a single-blog setup, that's fine, because everybody would essentially be viewing the same posts. However, in a multiple blog setting, that's not okay, because each visitor could essentially be viewing a completely different set of blog posts, so this won't work.

In this case, what's the best way to proceed. I had changed all of the code to handle the BlogID that's passed around in a few places (but not used), and updated the URLReWriter to check the domain/folder of the request and look up what BlogID it belongs to, setting it as a QueryString so that the other functions have access to it. Though I'm limited in C# (so maybe there's some special way to do it that's better), I'm pucturing either moving the Post List to each user's SessionState (though that could get huge if there are many posts or visitors), or updating the Post List to just check and see if the posts for the requested BlogID are refreshed, and load them if they're not. In this way, maybe I could add some sort filter when the application "gets a list of posts" that filters by BlogID, but the behind-the-scenes object would still load the entire list.

Does anybody have any thoughts. Have any other implementers of this feature been stumped by/solved this same problem? I'd consider uploading my code when it's working (it's just a bunch of crap right now), or if it would be helpful, I can send it to you in its correct state. Thanks for your help!
Jan 13, 2008 at 12:35 PM

Its been done.
You want to modify to use asp .net membership and MS SQL database as things will get really messy. You then can write some code to create the xml files for rss feeding that can be written for every update or rewritten everyday or what ever. few other tweaks here and there and some new code to handle some other stuff like auto generation of new blog for new users so you end up at your site with http://www.yoursite.com/ and sell hosting and so on. and your users can host and set up blogs automaticaly that look like http://blog.yoursite.com/username1/ and http://blog.yoursite.com/username2/ and so on..

Have fun.
Jan 13, 2008 at 2:15 PM
I think I see what you're saying, but I'd still need to build in the capability to pass around a BlogID, and then use the URLReWriter to convert the URL into a BlogID in the querystring, right? I've already switched to the MSSQL data provider, but I've had to add BlogID to a number of the tables to that the provider knows what blog they belong too. This still leaves the problem of making some changes to the Posts object - do I just make each request for all of the posts dynamic, and not cache anything? Also, instead of having the Searcher look through the cached posts, do I just have it reach directly into the database? That seems like the best way to do it, but I just want to make sure I'm on the right track.

Also, do you know of any code that's available that demonstrates this? I would imagine that, if it's been done, somebody has the solution already posted.
Jan 13, 2008 at 2:40 PM
Ah - I see what you're saying about the ASP.NET membership provider as well, but I already wrote my own MSSQL Membership and Role providers. I just took the XMLRoleProvider and XMLMembershipProvider and modified them using MSSQLBlogProvider as a layout template, and they work great. The only probably I ran across was that MembershipProvider.ValidateUser only takes two parameters (username and password), which leaves no room for BlogID. To get around this, whenever I make reference to a user object, I've changed the MembershipUserKey to BlogID.Username, and left the Username as it should be. That way, when I make my calls to the provider, I can essentially look the user up by BlogID (as long as I ensure that no periods are used as part of the username).

Does this address the "messy" problem you were talking about in the earlier post?
Jan 13, 2008 at 4:51 PM
Why didnt you just have the sign in as it was with your custom membership and then when logging in run
userid is validated =true get blogId. ( i thought about this hard - why would the blog id be different than the user name?)

Anyway i dont see how you are going to be able to separate the admins from the users. If you had 10 people sign in as admin they will be able to access anothers blogs admin.

Yeah it has been done lol by me and no you cant have the code because when i have finished microsoft may allow me to sell it around or they may wish to sell it on behalf.

Every sub domain eg http://blog.mysite.com/sub/ will be pre installed when the user signs up the "sub" will be re-written to the selected user id. (this speeds the proccess up from 12 minutes to 16 seconds to run the script) That user can sign in on any of my sites including any blogs with the same user id as i only use one membership database through out (but i am using unique identifiers that are stored in the database that fire them back to the login page they are accessing eg: my blog and im accepted by the identifier stored in the xml file on the blog that are written in by a script when they sign up.. Im currently working on a way they can update credentials using the script writter method.

So if my members have signed up on other sites of mine they wont be added to any of the xml files on blogs until they go to sign in. The database use's a stored procedure to check a user name and password. So if i was signing into your blog it fires into the xml my details to access as a user only and then redirects me to your blogs default page all nicely signed in and hassle free.

Microsoft will be able too run windows live id for membership.
I have created the capability of being able to monitor each installation.
Jan 13, 2008 at 5:37 PM
Edited Jan 13, 2008 at 5:40 PM
If I was using a "blogid" that was the same as the username, then this wouldn't be necessary, you're right, but I hadn't thought about it that way. I own about 15 domains that I'm going to use, and what I'd pictured was a user creating a login/password, and then having the ability to choose their blogname (in the URL), as well as the domain name that they want to use. Though they probably wouldn't change these things down the road, I plan on having a user be able to choose http://www.myblogdomain.com/blogname or http://www.bloggershere.com/myblog, etc, as they wish. They'll have a single sign-in username/password that gets them admin access to their blog.

In this way, I think that I need a BlogID, as there's no other way that I see to marry a username to a blogname, since they'll have a choice of name as well as domain. Also, I want the ability to "password protect" a blog, since they're going to be aimed at a market that might not want everything to be public. Since I want the ability to prompt a viewer for a password (and, potentially, a username), this presents another problem. I suppose one way around this is to include the "view password" in the blog details, so I wouldn't need another user lookup, but since the provider is already built, I may just end up including this as another login - I'll have to see.

In this case, I think I'm going to stick with the "BlogID.Username" format, and just prevent people from having a period in their username. This seems pretty straightforward, and it would accomplish what I'm looking for. However, I'm open to other ideas if anybody has any...
Jan 13, 2008 at 7:59 PM
Aha - I think I just got what you were saying. If I use the username as the "BlogID", regardless of what the http://www.domain.com or /blogname is, I can still look up the corresponding "BlogID" for a URL, and the person logging in has a clear link to that particular blog. The only thing I lose the ability to do is have a single login manage multiple blogs (how would it know which blog to manage?). But, for the time being, I'm not interested in this feature, and I can just have a "view password" as a column in the blog table. This would solve both of my problems, and would only create more overhead if I go forward with that other feature in the future...

So maybe this is the path to go for now. Thanks for the insight!
Jan 13, 2008 at 11:14 PM
Edited Jan 13, 2008 at 11:17 PM
Hi SpiderMaster, apologies upfront for drifting to a legal (off-)topic, but you wrote this interesting piece:

SpiderMaster wrote:
... no you cant have the code because when i have finished microsoft may allow me to sell it around or they may wish to sell it on behalf.


Now I'm (fortunately) not a lawyer, but just wondering if that's compliant with the Microsoft Reciprocal License (Ms-RL) that BE.NET uses? From the bits I (think to) understand, one can sell derivative work, as long as you use the same reciprocal license and share the code, or no?

Just trying to be considerate on potential legal issues. But hey, you were talking about selling to/via Microsoft, so I guess that part then is covered, checked and double checked ;-)

That actually rises more curiousity about their interest in your blog code. Doesn't Microsoft extensively use Community Server from Telligent Systems already? I mean, they use it for their official ASP.NET Weblogs, TechNet Blogs, MSDN Blogs and I know Microsoft's Dutch subsidiary uses CS as well.

Is Microsoft converting to BlogEngine.NET? :-)
Jan 14, 2008 at 2:50 AM


MikevZ wrote:
Hi SpiderMaster, apologies upfront for drifting to a legal (off-)topic, but you wrote this interesting piece:

Now I'm (fortunately) not a lawyer, but just wondering if that's compliant with the Microsoft Reciprocal License (Ms-RL) that BE.NET uses? From the bits I (think to) understand, one can sell derivative work, as long as you use the same reciprocal license and share the code, or no?



Currently we dont sell it, Here is what we provide on our systems.
You wont be able to view the learn more pages as you would need to be signed in as this control panels is only accessable from the hosting control panel typically and the learn more page is linked back to the hosting control panel for installation.

https://www.valueapplications.com/AllApplications.aspx?id=12

So to answer your question no i am not breaking any law and have respected the the legal owners.
I miss understood and was under the impression that this product was developed by microsoft as all legal contact is made through them.

My mistake but anyways.
Jan 14, 2008 at 10:25 AM
Edited Jan 14, 2008 at 10:34 AM
Thanks for your quick reply. Sorry, my mistake not articulating it right. Hope we'll straighten this one out:

SpiderMaster wrote:
[...] So to answer your question no i am not breaking any law and have respected the the legal owners.
I miss understood and was under the impression that this product was developed by microsoft as all legal contact is made through them. My mistake but anyways.

Frankly, I'm not questioning at all if you complied with the law or respected legal owners. Even if someone wouldn't, that's none of my business. I ain't no law officer (thankfully), just a BE.NET admirer with a curious mind. Figuring out if I'd need to share the source code of my upcoming ModPack and fishing for a Microsoft scoop (what a pity there wasn't any ;-)

I apologize again for any confusion and wish you all the luck with your developments!
Jan 18, 2008 at 3:38 AM
Actually you are in violation of the license if you distribute this.

(E) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
Jan 18, 2008 at 5:58 AM


ckincincy wrote:
Actually you are in violation of the license if you distribute this.

(E) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.


You mean the Microsoft EULA provided to us by Microsoft?
The one our servers install by default when a clients choose an application to install?
The same EULA that is provided as a pop up "Terms & Conditions" with "I agree" and "proceed with installation"?
I think you need to wipe your glasses dude.
Next time please read all the posts in regard to your comments before making them.

Thanks to everyone that has participated in distroying the original thread owner's (rwmnau) Forum :-(
Perhaps next time you would like to use the personal contact link before jumping in and being inconsiderate to others with your off topic postings..