This project is read-only.

VirtualPath vs. a PathFilter AppSetting for external hosts

Dec 24, 2007 at 1:47 PM
Since the initial release, we (need to) modify many lines in the source before BE.NET runs smoothly on my web host (GoDaddy). When the team introduced the AppSetting "VirtualPath", a lot of time got saved (using "/" to simulate operation as app root instead of "~/" what would inject an ugly full application path due to the enforced ISP configuration. To cut a longer story short: there's still tons of modification work left, which could pretty easily be avoided for future releases.

How? By adding a custom AppSetting (e.g. PathFilter), all to be done is adding the full AppPath value in the web.config which strips this in the final URL.

For example, even if we change the VirtualPath to "/", the PostPaging (previous/next posts) shows the full AppPath, since /User Controls/PostList.ascx.cs uses string path = Request.RawUrl.Replace instead of Utils.RelativeWebRoot (which still breaks other code if you remove the ~/tilde). This particular part got fixed by using a custom AppSetting (PathFilter) which snippet looks like this (adding using System.Configuration; at the top)

string pathfilter= ConfigurationSettings.AppSettings"BlogEngine.PathFilter";
path = path.Replace(pathfilter, string.Empty);

Perhaps, I'm one of the very few BE.NET users, running this great engine on a GoDaddy Deluxe Plan (causing the ugly Application Paths), so most will not even run in these issues. For now, we logged all the changes and compiled a new .dll too which makes v1.3 run on GoDaddy. Some tweaks are still quite dirty (like manually adding a SCRIPT SRC="/blog.js" in the theme because the virtualpath breaks the js.axd?path=) prevented most scripts to work.

Maybe you already want the change log for v1.3., but who's interested in ongoing development/support for upcoming versions to run on e.g. GoDaddy or other external hosts with limited trust settings?

Thanks and I hope it made sense. Merry Christmas and all the best for 2008!
Best regards, Mike
Dec 24, 2007 at 3:49 PM
Just out of curiosity, what so different in Deluxe? I'm running on GoDaddy shared out of the box and only needed to remove trust level line from web.config for both 1.2 and 1.3. Besides, GoDaddy now provides BlogEngine as one of standard applications that you can pick and they will install it for you...
Dec 24, 2007 at 9:41 PM
GD Deluxe allows you to run multiple websites (i.e. unique domain names) while Economy only resolves to 1 domain name. Since we run ~7 websites (each with own .com/net/etc), we picked that plan instead of an Economy version per site. Basically, this was our only reason, cause we don't need that enormous amount of extra storage and bandwidth. The extra SQL database might be handy and the cost difference isn't that shocking either: Economy costs $43 p/yr and Deluxe $75,50 p/yr. On the flip side, this multiple website feature causes this whole Application Path issue (every exra website needs to be configured as new application root, but instead GoDaddy uses "/" for each new website/domain, they configure the AppPath as DirectoryStructure (e.g. /sites/my-personal-blog/)
Dec 25, 2007 at 9:21 PM
It all make sense now, thanks for the answer.
Jan 21, 2008 at 4:21 PM

I'm hoping you can help me with an issue. I read your above post concerning Virtual Path and Path Filter but I'm not sure if it is the cause of my issue or the possible fix.

I am on a GoDaddy Delux plan and have installed BE in a subdirectory. It installed OK but I can't find a setting to let BE know that I am not in the root directory. When I click the HOME link it takes me to the root of my GoDaddy account and not the subdirectory where BE is installed. So far I am able to get around by manually adding the subdirectory to the path in my browser address bar to get to the page I need to go to but this obviously is not a suitable workaround.

So, the questions is... How do I set BE to work in a sub directory?

Thanks for everything you do!


PS - I do have this code in the root of my main site... Its purpose is to forward users who go to my main URL to my current blog (not a BE blog) located at

<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
Response.Status = "301 Moved Permanently";
Jan 21, 2008 at 5:48 PM
Edited Mar 10, 2008 at 3:24 PM
Hi Dugr, you can update web.config to use a default/official BE.NET in the specific subfolder:

<add key="BlogEngine.VirtualPath" value="~/blog" />

The "PathFilter" setting I talked about is not in BE.NET by default, but in the fine-tuned version for GoDaddy(alike), I called ModPack for BE.NET.

Have you heard of this custom-build version or perhaps even using it? (just checking).
If not, you might benefit too from ModPack for BE.NET.

If you are (or plan) using this stand-alone version, then you can use the PathFilter setting:

<add key="BlogEngine.VirtualPath" value="/blog" />
<add key="BlogEngine.PathFilter" value="/yourSub/UsedFolder" /> 

A few other ModPack-only pointers or considerations:
  1. Fine-tuned to run in the 'absolute web root' of your site (in your case
  2. Rewrites the /blog/ subdirectory TOO on your website by default (instead of /blog.aspx in a standard BE.NET)
  3. Site.master themes are modified as well to use hardcoded root links (e.g. "/" for home and "/archive.aspx") instead of ~/default.aspx

In addition to point 2, if using ModPack for BE.NET on your site, then works automatically.

As for point 3, really my bad that I changed to hardcoded / instead of the ~/ but AFAIK, the site.master can't use the handy BE.NET "Utils.RelativeWebRoot" (which uses the VirtualPath as specified earlier in the web.config) nor the PathFilter.

Can you use this information? You're always welcome to discuss this further either here, by email or phone if that works faster for you.

Jan 22, 2008 at 7:43 PM
Hi Mike!

Thanks for the reply.

Yes, I am using the ModPack for BE.NET that you referred to. Great so far but I guess I have a different scenario than most?

Here's where I am...
Using ModPack on a Godaddy Deluxe account.
I have installed BE.NEt into a subdirectory named FitnessBlog so the URL is
I also have another blog installed in a blog subdirectory and the URL is

I have modified the web.config of the BE.NET install as such...
<add key="BlogEngine.VirtualPath" value="/FitnessBlog/" />

and that is all I changed. That seemed to fix some of the issues. For example, now when I click Change Password it works. It no longer takes me to it now navigates correctly to

BUT... If I click on the HOME link it sends me to (it may actually be sending me to but I have a redirect that forces the navigation to

Does this all make sense? Now seeing exactly what I am doing can you help me get things set up the way I would like it to work?

Thanks for any and all help. This is a great project and I think I will like it better than my current blog choice once I am up and running.

Jan 22, 2008 at 11:06 PM
Hi Dugr!

You explained your scenario perfectly well, thank you! (also for using and improving the ModPack version!)

The short answer/immediate fix: try overwrite your theme folder (/FitnessBlog/Themes/CoffeeHouse/) with the original files.

Just for the record (feel free to ignore anything below), the long answer:
The links referring to a root URL is caused by my (unfortunate, yet needed) modification in the actual theme file.

I'm pretty sure if you'll use the "original/official" theme, the links at your site will work right again. So please try this:

  1. Download the official theme from
  2. Copy the extracted files to your /FitnessBlog/Themes/CoffeeHouse (overwriting is ok)
  3. Refresh your blog and check out if the links are properly directing now

I'll show the differences between the original (which use ~/default.aspx) and my modified version (with no tilde/~)

This is a snippet from the modified site.master (note the hardcoded paths)
   <li><a href="/">Home</a></li>
   <li class="page_item"><a href="/blog/">Blog</a></li>
   <li class="page_item"><a href="/archive.aspx">Archive</a></li>
   <li class="page_item"><a href="/contact.aspx">Contact</a></li>
Now the snippet from the original site.master (using the ~ and <asp:HyperLink> component
   <li><asp:HyperLink ID="HlHome" NavigateUrl="~/default.aspx" runat="server">Home</asp:HyperLink></li
   <li class="page_item"><asp:HyperLink ID="HlArchive" NavigateUrl="~/archive.aspx" runat="server">Archive</asp:HyperLink></li>
   <li class="page_item"><asp:HyperLink ID="hlContact" NavigateUrl="~/contact.aspx" runat="server">Contact</asp:HyperLink></li>
I'm fully aware my theme modications were less flexible and hardcoding links is usually (if not always) a bad practice.
The thing is though, the folder structure on my GoDaddy Deluxe account is two levels deep, like:


It's the way GoDaddy Deluxe multiple websites feature kind of "forced" me to use subfolders for every other domain+site I want to host on my single account.
As a result on my sites, all the ~/ links in themes and BE.NET code would resolve into links like -pretty ugly.
We (or at least I) wouldn't have this whole problem, if GoDaddy would just create a "root custom directory" (/) for every domain instead of /sites/van-zand/

Sorry for the info-overload, I'll post a short FAQ soon on the ModPack Updates feed.

Good luck, thank you again and please let me know if there's anything you need!

Jan 23, 2008 at 3:23 PM
Edited Jan 23, 2008 at 3:24 PM

Awesome reply, thanks! My blog appears to be working perfectly now.

I really appreciated that you took the time to respond with long and short answers. I ended up following your long answer and following steps 1, 2 and 3.

Thanks, that did it!

This GoDaddy ModPack is great, a real time saver.

Thanks for your efforts.

Jan 23, 2008 at 6:22 PM
OOps Mike!

I spoke too soon. All my links work EXCEPT for when I'm lodded in and clicking on any Admin links.

All the Admin links still go to the site root.

For example Add Entry goes here...

When it shoud go here...

From reading your reply above I'm starting to think that mabe I should set up my site like yours....



Would that work better with the Mod Pack?


Jan 23, 2008 at 8:59 PM
Edited Mar 10, 2008 at 3:25 PM
Hi Dugr, I forgot about that admin part here's the fix:

Replace the web.sitemap with the original version (available here just 449 bytes ;-)
(the only difference is the use of a tilde/~)

Since both your blogs use your primary domain name (, your setup and (sub)folder structure is fine and I wouldn't change it.

My folder structure is only useful (required actually) if your other blog(s) would run in a different domain or subdomain.

You can always contact me here, by email, voip/phone or anyway that works for you. I'm sorry for the extra hurdle!

Thank you for all your updates!
Jan 24, 2008 at 12:56 AM
HI Mike!

Thanks again for the reply. But I'm still not having any luck.

I replaced my Web.sitemap as you suggested but it did not help. I'm still having the same issue.

Any other ideas? I'm willing to try anything you can come up with.

Thanks again Mike!


PS - You wrote that it is OK to contact you via email, voip/phone or anyway that works but I can't find your contact info. I really appreciate your help!
Jan 24, 2008 at 1:10 AM
Edited Mar 10, 2008 at 3:25 PM
Hi Dugr,

Gosh, this is embarrassing: I zipped the wrong web.sitemap (the exact one you already got which didn't work). No wonder, I'm so sorry!!

Well, unless I've slept again - this should be the correct one:
You'll receive all my contact info in a minute too by CodePlex e-mail.

Thank -YOU-
Jan 24, 2008 at 1:19 PM
You DA MAN Mike!

Ya know... I had thought that may have been the case and tried to add the ~ myself but still could not get it right.

Thanks for all of the time you have spent on this mod pack and the time you have spent helping others. It is appreciated.

Now I'm off to add pages (one of the features I was excited about) and to see if I can get Al Nyveldt's Quote Of The Day Widget ( working. Then I'd like to see if I can figure out a way for someone to subscribe to my QOTD and display it on their site.

Fun stuff!

Thanks again.