i am able to login to another user blog and able to post.

Topics: ASP.NET 2.0, Business Logic Layer, Controls, Themes
May 21, 2012 at 3:40 PM

Hi, I used your open blogengine 2.5 code and i faced some issues while using this blogengine code.My first issues is that i create two Accounts in blogengine with role Editors say USER1 and USER2.Than i logged in as USER1 in blogengine that i create two blogs these two blogs aredisplay in my blog list,And than i logged in with USER2 and add two another blogs,
 than on my blogs list i see all the blogs added by USER1 and USER2. my issues is that i want only my blogs on my blog list not of another users. Another very main issue is that when i click on another users blog link that it shows me a login link i can logged in to another user blog and able to post. this must not happened. this is very crucial issue. Please help me.
please reply me as soon as possible.

Regards:
Karamveer

Coordinator
May 24, 2012 at 12:42 PM

If you have multiple Users, this allows you to create blog posts under each user name, however the blog posts are combined on the front page.  There is very little isolation between the Users and blog posts.

What you can do, however, is on the "Blogs" tab in the control panel, you can create a new blog instance.  Some details on how Blog instances work are here.  When you create a new blog instance, the new instance is very isolated from the "primary" instance.  You'll notice you already have a "Primary" blog instance ... that's the instance you've been using up till now.  You could create a new instance, and give it a Virtual Path of something like ~/richard (or anything), and then that instance's homepage will be http://www.example.com/richard.

Each blog instance has its own login page, it's own set of Users, it can have it's own theme, its own set of blog posts, etc.

May 31, 2012 at 8:30 AM

Hi, i have facing the same problem till now because when i create a blog using "Editor" user account, it is necessary to select a value from the drop down " Existing blog to create new blog"  than i select primary from the drop down list. the new instance of blog is not isolated from the "Primary" instance. i want to create a blog instance which is completely isolated from the primary instance. Only the creator of the blog have capability to log in in that blog.

 

I have gone through the code and database, i found that when i create a user (using admin account) i found that the user is registered under the primary blog. suppose i have created 10 users, all users are registered under the primary blog. and when user1 wants to create a blog and he select "primary" from  " Existing blog to create new blog" than entry 10 entries goes to table be_Users.  i found your query which you are using for creating the blog is

 INSERT INTO be_Users ( BlogId, UserName, Password, LastLoginTime, EmailAddress ) 
SELECT @newblogid, UserName, Password, LastLoginTime, EmailAddress  FROM be_Users  WHERE BlogID = @existingblogid

using this query 10 entry goes to table and aal user are able to log in to each other blogs.

I want that each blog is isolated from each other. Please give me a reply as soon as possible.

Coordinator
May 31, 2012 at 12:56 PM
Edited May 31, 2012 at 1:10 PM

When creating a new blog, the "Existing blog to create new blog" (as you saw) copies all of the data from that blog (existingBlog) to the new blog instance (newBlog).  This just happens once, and after that, the data is not mirrored for example, between the blog instances.

Ideally, if you had an empty blog instance that you could create, you could name that blog instance something like "Template", and then when you are creating new blogs for each editor, you could create them using the "Template" blog.

I noticed you are using the SQL blog provider.  The default XML provider actually has a "Template" blog instance that is essentially empty and can be used to create new blogs from.  The DB's however do not include a template blog instance, unfortunately.

What you CAN probably do is create your own "Template" blog in the SQL DB.  I haven't tried this, but what you can try is start off with the normal SQL Server 2.6 Setup script (MSSQLSetup2.6.0.0.sql).  The one that you probably started off with, and is also here:
http://blogengine.codeplex.com/SourceControl/changeset/view/c68c69a968b0#BlogEngine%2fBlogEngine.NET%2fsetup%2fSQLServer%2fMSSQLSetup2.6.0.0.sql 

Take that script, delete all the CREATE TABLE statements at the top, so you are left with just the INSERT statements (basically the first half is CREATE statements, and the 2nd half are INSERT statements).  You'll notice all the INSERT statements include the default/primary BlogID (27604f05-86ad-47ef-9e05-950bb762570c).  Do a Search and Replace, changing that to a new/unique GUID.  For example, 05306f47-fee2-450f-ade6-dbce2ba1b179.  And update the INSERT statement into [be_Blogs], so it looks like:

INSERT [dbo].[be_Blogs]
([BlogId], [BlogName], [Hostname],[IsAnyTextBeforeHostnameAccepted],
[StorageContainerName], [VirtualPath], [IsPrimary], [IsActive],
[IsSiteAggregation])
VALUES (N'05306f47-fee2-450f-ade6-dbce2ba1b179',
N'Template', N'', 0, N'template', N'~/template', 0, 0, 0)

That's the "Template" blog.  It's using the new GUID, and has a name of "Template", and is marked as Inactive and not the Primary blog.

Once you've done this, you should be able to run the script, and it will populate the Template blog into the DB, and it will also populate other default values into the other tables, for the new Template blog instance -- for example, the script will populate the be_Users table, and the be_Settings table, etc with some initial data for the Template blog instance.  Because you are manually modifying the DB, in order for the website to detect these manual changes, you'll need to restart the blog one time.  You can do this by making any change to the web.config file (add a space, etc).

You should then be able to create new Blogs using the normal admin UI... and select "Template" from the "Existing Blog to Create New Blog" dropdown list.

.......... Another approach I thought of instead of doing the direct SQL INSERT statements described above would be if you don't have a lot of data in your existing Primary blog instance, then create a copy of that using the normal admin UI, and in the copy, delete all of the data (Posts and Users), probably leaving one Admin user and leaving the roles, etc.  This could then become your Template blog.

Jun 1, 2012 at 1:55 PM


Hi, I have done all the changes as you mentioned above . I have created a "Template" blog using Admin UI..  and than create blogs using Editor Account and select "Template" from the "Existing Blog to Create New Blog" drop down list.  But my problem is still there, after creating a blog under Template than i am not able to log in in my own created Blog using Editor Account.  

My Problem is that :

Suppose we have two users  Editor1 and Editor2 than Editor1 create a blog name "Blog By Editor1" and Editor2 create a blog name "Blog By Editor2".  than all the blogs that are created by Editor1 are shown on Editor1 Blog list and must be able to log in in his own created blog and must be able to edit the blog.

Editor1 can only log in in his own created blogs not in Editor2 's created blogs.

Thanks for your quick reply.

Coordinator
Jun 1, 2012 at 3:06 PM

It sounds like you are getting closer.

Let's say you created a blog instance called Editor1, and it's based on the Template blog.  If the Virtual Path for the Editor1 Blog is ~/editor1, then the homepage for the Editor1 Blog will be www.yoursite.com/editor1.  And that blog has its own set of posts, its own set of users, its own theme, etc.  You need to log into that Editor1 Blog instance.  The login URL would be:  www.yoursite.com/editor1/account/login.aspx.  You would want to log in under an account that existed under Template, such as "admin".  You can check the be_Users table to see what users exist for the Editor1 Blog -- assuming you are using the DbMembershipProvider.

Once you log into the Editor1 Blog, you can go to the Users tab in the control panel, and change the users there (add new ones, remove users, etc).  Any changes you make are isolated to that Editor1 Blog instance.  Each blog instance has its own separate login page too.  So you can have it where Editor1 can only log into the Editor1 Blog instance (you give Editor1 his own username/password), and only Editor2 can log into the Editor2 Blog instance, etc.

I hope this makes sense, and I'm explaining what you are trying to do.