BlogEngine running with subdomain in subfolder

Topics: ASP.NET 2.0
Apr 24, 2008 at 9:22 AM
I'm getting strange problem with BlogEngine and GoDaddy's subdomain.
I searched the discussions and sucessfully installed BlogEngine in a subfolder, then I setup a subdomain to point to the subfolder, everythings seems ok, but the URLs on the blog are mixed with two format, confused....

BlogEngine is installed in the sub-folder called 'test', a sub-domain test.rotatingscrew.com is pointing to it.
While test.rotatingscrew.com can access the blog without any error, but I'm facing a problem, some URLs are like this:

Format A:
http://test.rotatingscrew.com/test/someurl.aspx

some are nomal:
Format B:
http://test.rotatingscrew.com/someurl.aspx

I konw this is a problem with Godaddy's subdomain, accessing http://sub.domain.com/sub/ is the same as http://sub.domain.com/,

but, all URLs in the blog should be in the same format, eighter format A or forma B, why are they mixed with two formats?
Does anyone know any workaround?

I've asked godaddy for the problem but they told me that it's the problem with their server setup so that the accessing rule cannot be changed. So I need to look for a solution to make BlogEngine to show all URLs in format B.

Thank you very much if you can help.
Apr 25, 2008 at 7:07 AM
As far as I remember this is what ResolveUrl would return when used in such setup. For resolve url the absolute path is http://sub.domain.com/sub/ and not http://sub.domain.com/

So I think if this is really important, you should find references to ResolveUrl in the code and replace them with your custom code taking the issue into consideration.

Alan.
Apr 25, 2008 at 4:00 PM


ailon wrote:
As far as I remember this is what ResolveUrl would return when used in such setup. For resolve url the absolute path is http://sub.domain.com/sub/ and not http://sub.domain.com/

So I think if this is really important, you should find references to ResolveUrl in the code and replace them with your custom code taking the issue into consideration.

Alan.


Thanks Alan, I'll have a try.
Do you mean 'ResolveUrl' keyword in all *.cs files or in all *.aspx files? To replace the keyword in source code manually is a huge work and mistakes may easily occure I think, I hope there's a quicker way maybe it can be replaced automatically or a setting in web.config can be done. Is it possible?

Miller
Apr 25, 2008 at 7:17 PM
GoDaddy sets your Application Path with the name of your subfolder (in your case "test")

So any link using the tilde (~) points to this full (and ugly) application path.
That's why I fine-tuned BlogEngine.NET for GoDaddy hosting plans:

ModPack (check out Codeplex project or the web site

Then you can set the VirtualPath without the ~tilde in your web.config like:
<add key="BlogEngine.VirtualPath" value="/" />

Use the custom web.config value "PathFilter" like:
<add key="BlogEngine.PathFilter" value="/test" />

Get your free copy (of course) if you're interested:
Download ModPack (1.3.0 Service Release 1 uploaded today!)

Cheers,
Mike

PS: full story on GoDaddy's VirtualPath vs. a PathFilter AppSetting for external hosts
Apr 25, 2008 at 7:50 PM
Edited Apr 25, 2008 at 7:51 PM


MikevZ wrote:
GoDaddy sets your Application Path with the name of your subfolder (in your case "test")

So any link using the tilde (~) points to this full (and ugly) application path.
That's why I fine-tuned BlogEngine.NET for GoDaddy hosting plans:

ModPack (check out Codeplex project or the web site

Then you can set the VirtualPath without the ~tilde in your web.config like:
<add key="BlogEngine.VirtualPath" value="/" />

Use the custom web.config value "PathFilter" like:
<add key="BlogEngine.PathFilter" value="/test" />

Get your free copy (of course) if you're interested:
Download ModPack (1.3.0 Service Release 1 uploaded today!)

Cheers,
Mike

PS: full story on GoDaddy's VirtualPath vs. a PathFilter AppSetting for external hosts


That sounds cool! Thank you! I'm trying it now.
Apr 25, 2008 at 8:20 PM


MikevZ wrote:
GoDaddy sets your Application Path with the name of your subfolder (in your case "test")

So any link using the tilde (~) points to this full (and ugly) application path.
That's why I fine-tuned BlogEngine.NET for GoDaddy hosting plans:

ModPack (check out Codeplex project or the web site

Then you can set the VirtualPath without the ~tilde in your web.config like:
<add key="BlogEngine.VirtualPath" value="/" />

Use the custom web.config value "PathFilter" like:
<add key="BlogEngine.PathFilter" value="/test" />

Get your free copy (of course) if you're interested:
Download ModPack (1.3.0 Service Release 1 uploaded today!)

Cheers,
Mike

PS: full story on GoDaddy's VirtualPath vs. a PathFilter AppSetting for external hosts


Hi Mike,
I've tried your modpack and viewed the thread you introduced, I added the PathFilter key and changed VirtualPath from "~/" to "/", but I got errors. Once the VirtualPath changed back, errors gone, but no path filter effect.
I have some steps different with others' steps, I'm using the modified version of SilverLight theme and already have some posts in the blog, so I didn't replace the theme folder and App_Data folder.
Is there still need something to do?


Miller
Apr 25, 2008 at 8:28 PM
Sorry Mike, seems something's wrong with the file replacment, I used godaddy's file manager to replace my files but seems files are not overwritten, I'll try it again.
Apr 25, 2008 at 10:02 PM
Hi Mike,
I'm back again. I tried your modpack, it worked, but I need to delete all of the old files to get it work and so that I lost all of my posts(I have my old whole dir backup).
I'd like to keep my old posts and catalogies, I replaced the app_data with my origional one but it ran into errors.
How to upgrad to your modpack but keep my posts?
Thanks!

Miller
Apr 25, 2008 at 11:49 PM
Edited Apr 25, 2008 at 11:50 PM
Hi Miller, thanks for trying ModPack to start with!

Good thing you backed up your files first.

All your existing App_Data should work 1:1 on the ModPack build. Same for your themes.
So what error are you getting exactly?

(ModPack's web.config debug is set 'false' and errors on 'RemoteOnly' - you'd need to set this to 'True' and 'Off' to get full error details)

As far as I can tell, you already took all the upgrading steps:

  1. Backup your custom theme and App_Data folder (those especially, but make a full backup too just in case)
  2. Delete all your files and folders
  3. Copy everything from the ModPack .zip file into your web root (GoDaddy's FileMgr is fine)
  4. Restore your backed up App_Data (double check if permissions is still set on read+write)
  5. Restore your custom theme into the Themes folder
  6. Tweak your new web.config file with the VirtualPath="/" and PathFilter="/test"

Tip for step 1: use GoDaddy's archive function in their File Manager to archive all your files for a full backup
Tip for step 3: simply upload the .zip to your webroot and use GoDaddy's unarchive function. That saves you a lot of upload time. For some reason, the new File Manager extracts to a new folder called _ControlPanel - rename it to "test" if you completely removed your old folder and reset the read/write permissions on the App_Data folder

Let me know what exact error you're seeing. I'm sorry for the rougher ride than expected.

Thanks again for checking out ModPack, Miller!

Cheers Mike

BTW: off to bed now and spending tomorrow with my 2 little girls - I'm all yours this Sunday
Apr 26, 2008 at 8:05 AM
Edited Apr 26, 2008 at 8:15 AM


MikevZ wrote:
Hi Miller, thanks for trying ModPack to start with!

Good thing you backed up your files first.

All your existing App_Data should work 1:1 on the ModPack build. Same for your themes.
So what error are you getting exactly?

(ModPack's web.config debug is set 'false' and errors on 'RemoteOnly' - you'd need to set this to 'True' and 'Off' to get full error details)

As far as I can tell, you already took all the upgrading steps:

  1. Backup your custom theme and App_Data folder (those especially, but make a full backup too just in case)
  2. Delete all your files and folders
  3. Copy everything from the ModPack .zip file into your web root (GoDaddy's FileMgr is fine)
  4. Restore your backed up App_Data (double check if permissions is still set on read+write)
  5. Restore your custom theme into the Themes folder
  6. Tweak your new web.config file with the VirtualPath="/" and PathFilter="/test"

Tip for step 1: use GoDaddy's archive function in their File Manager to archive all your files for a full backup
Tip for step 3: simply upload the .zip to your webroot and use GoDaddy's unarchive function. That saves you a lot of upload time. For some reason, the new File Manager extracts to a new folder called _ControlPanel - rename it to "test" if you completely removed your old folder and reset the read/write permissions on the App_Data folder

Let me know what exact error you're seeing. I'm sorry for the rougher ride than expected.

Thanks again for checking out ModPack, Miller!

Cheers Mike

BTW: off to bed now and spending tomorrow with my 2 little girls - I'm all yours this Sunday


Hi Mike,
It should be me to thank you, you are making such a useful thing and sharing with everyone.
I confirmed my steps, I'm sure the whole steps were correct, but toady I tried and I got different error today, so strange....

These are my steps I've done just now:

1. I extracted your modpack into a folder in my computer, and deleted the App_Data folder
2. I downloaded my origional App_Data folder to the extracted modpack folder
3. I copied the modified theme to the theme folder
4. I Modified PathFilter in web.config (This file was came from your modpack) to match my folder name.
5. Then, I zipped the folder into a zip file, uploaded to the ftp root, use Godaddy's file manager to unzip,
6. Deleted the whole old blog dir
7. Rename the extracted folder as the same name of the deleted one
8. Moved the whole new blog dir to root dir.
9. Set permission of App_Data.

Ok, all thing done, after these steps, I got error (yesterday) like this:


<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>


Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.


<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>


And this kept happening even I tried many times to repeat zipping, unzipping, deleting, renaming....
and after I restored my old blog dir back to the origional one it returned normal.

BUT, TODAY....I did the same steps, nothing different....

It seems ok to run because it didn't just show me an error when I visit the home page, and my old posts showed BUT...

The "Proceed Your Blog to the Next Level" is at the top of homepage, I though this file is in AppData right? But I didn't upload the AppData of modpack, I uploaded the origional one (no just replace, I deleted the App_Data folder first, then copied the origional one into it), so where was it came from??? Confused......

Well, it doesn't matter, I can delete it, so I click the login link, and input my user name and password, click on the login button, oh.....the same error comes to me again......

Maybe there's some bugs with the file manager???? I'l try it again to upload all files by ftp....

Miller
Apr 26, 2008 at 2:11 PM
Hi, Mike,
After spending more than 4 hours uploading the whole blog with CuteFtp
(
I don't konw why godaddy's ftp need take so much time, so many errors occur when uploading many files at the same time except uploading the files one by one, that's impossible for the blog, last time I uploaded the blog took the same long time...
)

Finally after a thoudsands of times clicking the retry menu, the blog's been uploaded. I got the same problem, the "Proceed Your Blog to the Next Level" remains, and clicking the login item, an error as the same as I posted showed up.

I noticed here's a very very strange thing: Modpack shows things that don't actually exist in AppData: the "Proceed Your Blog to the Next Level" and the blogroll (blogroll.xml does not even exist in AppData, but there are many links in the blogroll. Blog ghosts???).

Miller
Apr 26, 2008 at 4:04 PM
Mike,
Me back again, I finally get the ghosts gone....
I don't exactlly know why the "blog ghosts" are there, but I think it's some kind of caching...I found that when some files updated or delected or moved or something done by me, in the godaddy file manager (not sure maybe also CuteFtp), sometimes it has no effect, even I refresh IE, delete IE cache, the pages are ugly not refreshed but combined with new and old content....can't explain that, but fortunately now seems the ghost's are gone, don't know why......

Well, but still something not working, the Login button, click then error comes. I don't know if its about the theme, maybe it needs some tweaks, but I couldn't open the modpack homepage so I havn't tried. Since I can't login I can't change the theme to standard.
So, I changed the setting.xml to see if can use the standard theme to login but even the "<theme>SilverLight</theme>" is changed to "<theme>Standard</theme>" in settings.xml, even replace the xml with the one which shipped with modpack, the theme kept being SilverLight. Ghosts back again.....I have no idea. oops...

Ok, I can't use the login button then I don't use the login button, after typing "login.aspx" in the address bar, and get reached to the login page, type my user name and password, and then the page shows me the same error message again.
Apr 26, 2008 at 8:47 PM
Hi Miller,

ModPack's App_Data folder contains that welcome post ("Proceed Your Blog ...").
Just there, nowhere else so I assume in some way that specific .xml file is included during the copy.

Uploading files to GoDaddy accounts takes a truckload of time indeed.
Especially when FTP starts those many small files (like the flag pictures in .png format).
That's why their unarchive function works like a charm - just upload a single .zip
and let GoDaddy's File Manager do the rest of the work.

Weird still though, you're seeing mixed data, cache or "ghosts" as you call them.
The one thing that comes to my mind is this:

  • Upload the .DLL into the /bin folder as very last file - this will completely restart the application; flushed & well

What's strange too is the lack of detailed error information is thrown. You're not getting any specific messages or pointers to lines in the source code?
Could you send me the URL of your blog? (direct msg me if you want to keep it private)

Thanks Miller for your invested time and for trying out different scenarios!

Cheers @MikevZ
Apr 26, 2008 at 9:03 PM
Miller, just found your URL in this other thread Installing BlogEngine 1.3 in a /blog subdirectory. How?

Looks like ModPack is working: no errors, no ugly path and showing your SilverLight theme.
A short note on themes and "ugly paths":

BE.NET themes use the ~/tilde links for home/contact/archive, etc.
So as soon as your blog resolves the installed (e.g. when you click login)
the URL/path starts including /miller/ for all other ~links.

A workaround is to replace ~/tilde links in theme files with this:

<%=Utils.RelativeWebRoot%> (which is the home)
<a href="<%=Utils.RelativeWebRoot%>"archive.aspx</a> for the archive
<a href="<%=Utils.RelativeWebRoot%>"contact.aspx</a> for contact page

The only link that's a bit more challenging is the "author link", which is configured in PostView.ascx instead of Site.Master.
By default you can't use this <%=Utils.RelativeWebRoot%> in PostView.ascx until you include this code in there:

Add as 2nd line in PostView.ascx: <%@ Import Namespace="BlogEngine.Core" %>

Hope this makes sense. Let me know any time if you need additional pointers, tips, code, etc.
Welcome to the BlogEngine.NET community!

Cheers Mike
Apr 27, 2008 at 7:14 AM


MikevZ wrote:
Miller, just found your URL in this other thread Installing BlogEngine 1.3 in a /blog subdirectory. How?

Looks like ModPack is working: no errors, no ugly path and showing your SilverLight theme.
A short note on themes and "ugly paths":

BE.NET themes use the ~/tilde links for home/contact/archive, etc.
So as soon as your blog resolves the installed (e.g. when you click login)
the URL/path starts including /miller/ for all other ~links.

A workaround is to replace ~/tilde links in theme files with this:

<%=Utils.RelativeWebRoot%> (which is the home)
<a href="<%=Utils.RelativeWebRoot%>"archive.aspx</a> for the archive
<a href="<%=Utils.RelativeWebRoot%>"contact.aspx</a> for contact page

The only link that's a bit more challenging is the "author link", which is configured in PostView.ascx instead of Site.Master.
By default you can't use this <%=Utils.RelativeWebRoot%> in PostView.ascx until you include this code in there:

Add as 2nd line in PostView.ascx: <%@ Import Namespace="BlogEngine.Core" %>

Hope this makes sense. Let me know any time if you need additional pointers, tips, code, etc.
Welcome to the BlogEngine.NET community!

Cheers Mike


Oh sorry I forgot to tell you where my blog is, I've remove the test folder and retried in the miller folder.
I modified SilverLight theme (I didn't design the theme, I just modified it to fit my needs) to use <%=Utils.RelativeWebRoot%> instead of ~, but still can't login.

I noticed two things may be useful to help to figure out the problem:

1. If I goto archive.aspx page first, then click Login button, no error shows and the login page can be shown (but still can't login).

2. If I manually add "?theme=xxx" (xxx = SilverLight, Standard, CoffeeHouse etc...) after the current page's url, like:
http://miller.rotatingscrew.com/default.aspx?theme=SilverLight
I can click on the login button without error and see the login page, then if I add "?theme=xxx" again to the login page's url, reload the page with the theme parameter, then I can login.

I'd like to contact you on msn if you don't mind, so that I can give you the login account of the blog if you need to test on it.
My msn is : webmaster@neocactus.com (I'm not the webmaster though....)
I really appreciate your so much help.
Apr 27, 2008 at 8:31 AM


MikevZ wrote:
Hi Miller,

ModPack's App_Data folder contains that welcome post ("Proceed Your Blog ...").
Just there, nowhere else so I assume in some way that specific .xml file is included during the copy.

Uploading files to GoDaddy accounts takes a truckload of time indeed.
Especially when FTP starts those many small files (like the flag pictures in .png format).
That's why their unarchive function works like a charm - just upload a single .zip
and let GoDaddy's File Manager do the rest of the work.

Weird still though, you're seeing mixed data, cache or "ghosts" as you call them.
The one thing that comes to my mind is this:

  • Upload the .DLL into the /bin folder as very last file - this will completely restart the application; flushed & well

What's strange too is the lack of detailed error information is thrown. You're not getting any specific messages or pointers to lines in the source code?
Could you send me the URL of your blog? (direct msg me if you want to keep it private)

Thanks Miller for your invested time and for trying out different scenarios!

Cheers @MikevZ


After modifying customErrors in web.config, the server can show more detail of the login error:

Server Error in '/miller' Application.
--------------------------------------------------------------------------------

'~/themes/SilverLight/css.axd?name=silverlight.css' is not a valid virtual path.
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.Web.HttpException: '~/themes/SilverLight/css.axd?name=silverlight.css' is not a valid virtual path.

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:


HttpException (0x80004005): '~/themes/SilverLight/css.axd?name=silverlight.css' is not a valid virtual path.
System.Web.VirtualPath.Create(String virtualPath, VirtualPathOptions options) +3626815
System.Web.VirtualPathUtility.IsAppRelative(String virtualPath) +9
BlogEngine.Core.Web.Controls.BlogBasePage.CompressCss(ControlCollection ctls) +409
BlogEngine.Core.Web.Controls.BlogBasePage.CompressCss() +70
BlogEngine.Core.Web.Controls.BlogBasePage.OnLoad(EventArgs e) +576
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436


Not only the silverlight theme but the Standard and CoffeeHouse in modpack theme also have login problem.
Apr 27, 2008 at 1:14 PM
Hi Miller, added your MSN account now.

Start our conversation when you're ready. I'm very curious what's going on with your installation, since those error messages doesn't make sense to me yet.

Cheers,
Mike
Apr 27, 2008 at 8:07 PM
Thanks for our friendly chat, Miller - I'm glad we solved the blog issue.

To share the solution with our community:

Turned out the "trim stylesheets" option needed to unchecked to get rid of the login issues.

Hope to talk with you soon and enjoy your blog writing!

Cheers Mike
Apr 27, 2008 at 8:16 PM
Problem SOLVED.

Many thanks to Mike, with Mike's help on MSN, I finally get my blog work without problems.

The problem is caused by the "HTTP Compression" and the "Trim stylesheets" option in BlogEngine (I need to uncheck them), maybe these two functions are having some compatibility issues with Godaddy. But the problem didn't happen when using the origional BlogEngine, I don't konw why.
Apr 28, 2008 at 2:50 PM
I also used Mike's modified package and sure it did work.

nice job Mike!


cheers,

Aug 23, 2008 at 4:29 AM
I just upgraded to BE 1.4.5 and I'm still having an issue with my godaddy subdomain.  Most links translate to http://john.rummell.info/john/blog/ instead of http://john.rummell.info/blog/.  Is this fixed in 1.4.5? If not, will ModPack work with 1.4.5?

Thanks!
John