URL pathing problem in 2.5

Nov 1, 2011 at 9:45 PM
Edited Nov 1, 2011 at 9:46 PM

I'm running 2.5 in a sub-folder/sub-application and having some issues with URL pathing with the Edit and Permalink links from the AdminLinks area. Running it from VS2010 works fine but when I run it on the development server (Win2k8 R2, ASP.NET 4.0 Classic) I have these strange URL problems. Below is an example of the botched URL. Any ideas what's going on? Thanks!


Nov 2, 2011 at 12:50 AM

I'm having the same issue. Just created a new discussion in the forum. I'm able to create posts in root level of the blog site. But when I create a new blog, I'm facing the issue. 

Nov 4, 2011 at 7:05 AM
Edited Nov 4, 2011 at 7:05 AM

hi same issue as mine except I am running it from vs2010

this is the workitem


Nov 4, 2011 at 1:00 PM

I was able to track down the source of the bug. What's happening is the Utils.AbsoluteWebRoot property is not correct. This happens because it uses the Utils.ConvertToPublicUrl method which uses the query string of the current request to generate the URL. Meaning, the AbsoluteWebRoot property will change depending which page you are on. This is why links on the homepage will work but nowhere else. Below is code that will fix the bug:

Edit this line in the Utils class (around line 127):

absoluteurl = new Uri(ConvertToPublicUrl(context, new Uri(RelativeWebRoot, UriKind.Relative)));

And replace it will this:

//absoluteurl = new Uri(ConvertToPublicUrl(context, new Uri(RelativeWebRoot, UriKind.Relative)));
absoluteurl = new UriBuilder
    Host = context.Request.Url.Host,
    Path = Utils.RelativeWebRoot,
    Port = !BlogSettings.Instance.EnablePortForwarding ? context.Request.Url.Port : (context.Request.IsLocal ? context.Request.Url.Port : BlogSettings.Instance.ForwadingPort),
    Scheme = context.Request.Url.Scheme,
    Query = ""

Nov 5, 2011 at 7:08 AM

Hi & thanks for this.  Your code does fix the problem and is very helpful.

The ConvertToPublicUrl() function is being used in some other places and is causing similar problems.  I just backed out some of that code, back to before ConvertToPublicUrl() was introduced -- fyi.  It's in the latest checkin,

Nov 7, 2011 at 4:00 AM

Hello asherrick,

I'm glad you are able to fix that. I'm trying to find the piece of code you modified, but couldn't find where it is. Could you please tell me where exactly I need to modify the code. I'm using 2.5 version of the BlogEngine.Net.



Nov 7, 2011 at 12:22 PM


The Utils class is in the Core assembly. Look for Utilcs.cs in the /DotNetSlave.BusinessLogic/ folder. Note that you will need to recompile in Visual Studio after making a change. If you're not sure how to do this, just download or newer which is fixed.

Nov 17, 2011 at 11:33 PM
Edited Nov 17, 2011 at 11:33 PM

Hi ashrrick / BenAmanda,

Thanks for the reply. I've deployed the ( version and ( version to test if the issue fixed or not. But for both version I'm still getting the same issue. you can see the issue I'm facing at below URL.

http://blogs.dotanimations.com/template/Account/login.aspx... here Image of the blogengine is broken.

I can not see the HTML edit panel when I edit any post (http://blogs.dotanimations.com/template/admin/Posts/Add_entry.aspx?id=c3b491e5-59ac-4f6a-81e5-27e971b903ed) inside a new blog and can't save the post also. You can test that as well as I haven't changed default admin account. Its working perfectly fine when I create any post in root level site.

Please let me know if I'm missing anything.

Note: I'm using SQL server as the back end. Thats the only thing I've updated to the site.



Nov 18, 2011 at 12:51 AM


Are you sure that you're settings for the second blog are correct? I'm guessing that the Virtual Path should be "~/template/" (no quotes).

Nov 18, 2011 at 1:32 AM

Hi asherrick,

Thanks for the response. The virtual path name I'm using as you mentioned.

Name: Template

Storage Container Name: template

HostName: <Blank>

<label class="lbl" for="cbAcceptAnyTextBeforeHostname">Accept Any Text before Host Name: True</label>

Virtual Path: ~/template

Active: True

Please let me know if the settings are wrong. I dont mind if you want to login and create a new blog in the site to test. I've not changed the admin password yet :)

Appreciate your help.



Nov 18, 2011 at 1:37 AM

I did a very quick test on one of my installations and it appears to suffer the same problem when I create a second blog instance. Looks like another bug...

Nov 19, 2011 at 3:02 AM

There's two possible explanations for this.

This is in response to blogs.dotanimations.com.  That is running on IIS6.  There's an IIS setting so ASP.NET handles all requests to the server.  My Sept 20th posting in this thread with a link to learn.iis.net shows how to add a "wildcard application mapping".

Chances are adding that application wildcard mapping should fix the problem.

For others who might be on IIS7, you might want to try the "runAllManagedModulesForAllRequests" setting also brought up in that same thread.  If that doesn't work, then it may be the way that your IIS7 hosting environment is configured -- i.e. it may be a setting that the webhost controls that you may be stuck with.  Recently I was looking at a BE 2.5 IIS7 installation at WinHost (I think), and even with runAllManagedModulesForAllRequests, the non-ASP.NET content for the virtual path sub-blogs would not render.  This was because the requests for JS, CSS, AXD content etc were not going thru ASP.NET, so BE did not have a chance to rewrite the path.  Some hosts such as DiscountASP.NET have better environments where you have more control and are able to set runAllManagedModulesForAllRequests, and all requests go thru ASP.NET.