BlogEngine in subdirectory

Apr 14, 2014 at 5:20 AM
I'm trying to use BlogEngine with existing app. So I created a folder just for BlogEngine called "Blogs" and configured and changed few things to make most stuff work. But after login (admin/admin), I'm getting errors loading all admin pages like "blogs", "dashboard", etc.

One example of error is coming from "Blogs" tab, where it says "Error loading Blogs". I traced down to blogs.js and exception is thrown from dataService.GetItems('/api/blogs', .....

Fiddler indicates 404 error but points to "/Blogs/api/blogs?filter.....", which should be correct at runtime.

Can someone help me to right direction for this exception, please? Thanks.
Apr 14, 2014 at 3:40 PM
In IIS, did you add a Virtual directory or an Application? I used an Application and it works fine.

There is also this setting in the web.config:
<!-- You can e.g. use "~/blog/" if BlogEngine.NET is not located in the root of the application -->
<add key="BlogEngine.VirtualPath" value="~/" />
Changing this to "~/Blogs/" might help if you are using a virtual directory. It is not needed if you create an application in IIS (in my experience).

Hope this helps!
Apr 14, 2014 at 6:35 PM
Thank you for your reply.
I'm trying to avoid setting up separate virtual directory. I already modified the web.config for the exact change you recommended. My goal here is to create one app that can share common themes, css, etc and also to use one session for user login. So for the end product, blogengine will work more like a plug-in to an existing app. I feel like I'm very close because all of blogengine works except these exceptions. Based on your experience, is there anything else I can try?

Apr 15, 2014 at 11:42 AM
Ah, I get it now... I was thinking about a normal setup, which is all I know about. I'm afraid I can't help you. Good luck figuring it out though.
Apr 17, 2014 at 1:32 PM

It was the route table.
Apr 22, 2014 at 8:19 AM
Hi scottiedog

What version of blogengine were you using as I'm trying to find links that will help me in setting up 2.9 as a subdirectory without creating a virtual directory in IIS. I'm not having much luck and thought you could point me in the right direction.
Apr 22, 2014 at 1:59 PM
Hi, candycane478,
I used Seems like you are having similar requirements as I do. My version is mostly working except if I turn on "url without extension", the menu links on the top won't work. I figured I'll work on that later.

Would you be interested in the version I'm working that works with above problem? That will get you started and save you from following instructions. I did find few links but they are mostly outdated as BlogEngined has evolved significantly. Let me know.
Apr 22, 2014 at 2:10 PM
Just so that I understand your requirement, you want to put all BlogEngine code under a subdirectory within a existing app, right?
Apr 22, 2014 at 2:57 PM
Edited Apr 22, 2014 at 3:02 PM
That is correct, I'm not sure if it's exactly what you did, but I also found links that referred to older versions and couldn't get part of it to work using it.
Apr 22, 2014 at 2:58 PM
Edited Apr 22, 2014 at 3:00 PM
The version I have is 2.9.1, so I'm hoping nothing majorly different.
Apr 23, 2014 at 4:05 AM
Download from this link. BE code is under "Blogs". The zip also contains some of my added code unrelated to the BE.


Note, I'm using SQL database for the store so you will need to set one up and enable the connection string or switch back to Xml store in web.config. And if you decide to use SQL, is missing these statements so execute these lines

INSERT [dbo].[be_RightRoles] ([BlogId], [RightName], [Role]) VALUES (N'27604f05-86ad-47ef-9e05-950bb762570c', N'ViewDashboard', N'Administrators')

INSERT [dbo].[be_Rights] ([BlogId], [RightName]) VALUES (N'27604f05-86ad-47ef-9e05-950bb762570c', N'ViewDashboard')

Good luck and report back any issue, I might be able to help you further.

Apr 23, 2014 at 12:37 PM
Thank you for the link, I'll take a look at it.
I also needed to have a SQL database for the store, so I won't need to change anything in the config besides what you have listed above.

Thanks again for your help and I'll let you know if I need any more assistance.