Child Blog Style Links

Topics: Business Logic Layer
Apr 16, 2012 at 1:44 PM


I recently updated my blog to from .  After updating to this version I'm having trouble with the styles in my non-primary blogs.  The reference to the style bundle appears to be correct on the primary blog, but on the secondary blog the reference does not work.  I can adjust to reference to make it work but I'm guessing that shouldn't be necessary.  Just wondering if anyone else is having this issue.

Primary blog style link which works for primary but not for secondary blogs: <link href="/blog/Styles/css" rel="stylesheet" type="text/css"



If I change the secondary blog to reference the style via /blog/blog/Styles/css then the style works correctly for the secondary blog.



Apr 16, 2012 at 2:21 PM

What theme are you using and do you have this problem if you switch to standard theme?

Apr 16, 2012 at 9:01 PM

Thanks for your reply rtur.  I am using a custom theme for each of my three blogs.  I did have to make an update to the code of Helper.cs to make sure that the stylesheets were added before my theme styles were added on the page (like they used to be in  Without making that update then my theme stylesheets were no longer overriding the global style like they did before I updated to  Could this have caused the problem?  I can look into changing the theme to Standard and see if I still have the same issue.

I made the update to AddStyle() in Helper.cs as follows

        public static void AddStyle(System.Web.UI.Page page, string lnk)
            page.Header.Controls.AddAt(0, new LiteralControl(
                string.Format("\n<link href=\"{0}\" rel=\"stylesheet\" type=\"text/css\" />", lnk)));
Apr 16, 2012 at 9:17 PM

I get the same problem (only on the non-primary blogs) after switching the theme to the standard theme.  I also get the same problem (again only with teh non-primary blogs) when I switch the secondary blog theme to the same theme which works on my primary blog.

Apr 19, 2012 at 6:47 PM

Bump.  :)  Any ideas?

Apr 20, 2012 at 2:24 AM

Actually .42 was specifically to fix this problem, it works with standard and custom themes for me. Not sure why would it do differently for you, may be if it was upgrade and some files were not copied over or something like this.

Apr 20, 2012 at 2:23 PM

Thankjs rtur.  I'll recompare the code files and see if I missed something.

Apr 20, 2012 at 5:18 PM


After deploying the blog engine code to my beta server and using the standard theme without any of my custom code included at all I still see the same issue I've been running into.  My primary blog's css reference appears to work and the secondary blogs appear to fail.  I notice the css not being applied in the next posts/previous posts pager on the secondary blogs.  My primary blog displays the next posts/previous posts pager correctly.  Only the secondary blog appears to be missing the style.

When I try to reference [blog path]/blog/Styles/css from my primary blog the stylesheet is served up.  When I try to do that in my secondary blog I receive the error shown below.  Also, if I attempt to access the style sheet via [blog path]/blog/blog/Styles/css in my secondary blog then the stylesheet IS served up.  All of my blogs are set up as a applications underneath a parent site.  All of the blogs are referencing the codebase behind the scenes.  Can you confirm your pager appears correct on your child blogs and that you can access the style sheet correctly from your child blogs where I am unable to?  I greatly appreciate your help.

Server Error in '/blog' Application.

The virtual path '/STYLES/CSS' maps to another application, which is not allowed.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: The virtual path '/STYLES/CSS' maps to another application, which is not allowed.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[ArgumentException: The virtual path '/STYLES/CSS' maps to another application, which is not allowed.]
   System.Web.VirtualPath.FailIfNotWithinAppRoot() +3126186
   System.Web.HttpContext.RewritePath(String path, Boolean rebaseClientPath) +156
   System.Web.HttpContext.RewritePath(String path) +6
   BlogEngine.Core.Web.HttpModules.UrlRewrite.ContextBeginRequest(Object sender, EventArgs e) in UrlRewrite.cs:369
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.237

Apr 20, 2012 at 5:59 PM

Definitely works on my local IIS, just checked. I'll put it up on public server later tonight and give you a link so you can compare and see what's different, it is got to be something with environment like configuration or permissions.

Apr 21, 2012 at 1:45 AM

I setup test blog at:

The child blog is:

Take a look and see what is different with your site. Child blog has multiple pages, standard theme and code is plain download uploaded with no modifications, only test posts added. Few images missing but styles look fine.

Apr 24, 2012 at 2:13 PM

Thanks for taking the time to set up the test blogs for me.  I agree the problem must be environment related instead of code related.  I'll review my server settings and see if I can figure out why the stylesheet URL isn't resolving like it should.



Apr 24, 2012 at 2:51 PM

I think I figured out the difference between our setups.  You have a blog hosted in the root folder and another blog hosted in a virtual folder inside the root folder.

My setup requires three different applications in IIS and each application has its own virtual directory for its blog.  Each blog virtual directory is pointing to the same blog engine codebase on my server.

After reviewing your setup I see that your secondary blog is referencing the style sheet via /blog/Styles/css which resolves to (the style handler of your root blog) instead of (the style handler of your secondary blog).  Is this the intended functionality?

This will not work for me because I have three separate IIS applications so I would need to reference the stylesheet in a similar manner as the later URL does.  Is it possible to make it function in this manner?

Thank you for all your help!



Apr 26, 2012 at 12:05 PM
Edited Apr 26, 2012 at 12:05 PM

If you want to put each blog instance into its own virtual directory/application, you can do that, but in that case, you wouldn't be able to use Child blogs.  Instead, you would install BE once for each virtual directory ... so 3 installations of BE instead of just installing it once.  Each installation would have just a single blog instance in it.  This is the traditional way someone would install BE multiple times before the child blog system was introduced in BE 2.5.  With the new child blog (aka multiple blog) system, it's intended to work where it's all running in a single IIS site or application.

May 5, 2012 at 2:12 PM

Thank you for your help.  I'll see if I can adjust how i'm hosting the blogs in IIS.