Broken stuff on Medium+ Host (#4778)

Sep 27, 2007 at 2:44 PM
Hi everyone, after letting it rest for a while, I decided to test run build 4778 on an ISP with Medium+ trust and ran into these issues:

The option to set the VirtualPath in the web.config is helpful to force 'trimming' of unwanted AppPath in the AbsolutePath

- However, some generated links are still using the Full AppPath:

  • The Archive -- fixed by updating MonthList.cs to remove the ~ in: anc.HRef = VirtualPathUtility.ToAbsolute("~/") + "?year=" + date.Year + "&month=" + date.Month;
  • The Category List -- fixed by updating CategoryList.cs to remove the ~ as well
  • The Author (feed)link in the actual post uses the full AppPath as well -- fixed by updating the theme's PostView.aspx and delete the ~ as well
  • All admin links (but that's of less importance because readers won't see that anyway)

- Using that VirtualPath setting to "/" breaks the CSSHandler.css in Core/Web/HTTPHandlers/ cause the host doesn't allow this:

<snip> string file = context.Server.MapPath(Utils.RelativeWebRoot + "themes/" <snip>

Fixed by changing that to: string file = "~/themes/" + BlogSettings.Instance.Theme + "/" + context.Request.QueryString"name";
and then recompile - also I had to disable any CSS optimization / white space removal in the Admin settings

- I had to change the code in /App_Code/Controls/Blogrolls.cs to allow the fetch from SecurityLevel > LOW instead of MEDIUM
(because the host IS operating on Medium Level BUT allows HTTP/WebService calls)

Hope that all makes sense. Just trying to make it work on such an ISP/host as well
Coordinator
Sep 27, 2007 at 4:22 PM
I've gone through your list and fixed all of it. It all now uses Utils.RelativeWebRoot which adjusts for the appSetting path.
Sep 27, 2007 at 5:06 PM
Fabulous Mads, thanks a lot!

Whenever you have time (since the Admin section links don't have high priority) - could you tell me in what code those URLs are constructed?

Whenever I search for ~ through all the files, the only result I get is /Admin/admin1.master. There I can (and have) removed ~ trailer to the actual FrontPage so at least whenever I leave the admin section, I'll be directed to my desired URL instead of the full AppPath.

My C# is too limited to understand and update "/admin/menu.ascx" to generate AppPath-less links.

Thanks in advance,
MikevZ
Sep 27, 2007 at 5:48 PM
@Mads: I've noticed in your next build, that the CategoryList is not updated.

(also, I had to switch back to .dll build 4778, since it threw me an invocation error onLoad of the XMLProvider, let me know if you want details)
Sep 27, 2007 at 5:51 PM
And hey!? Did that BlogRoll.cs SecurityLevel check completely disappear? If yes: great! :)
Coordinator
Sep 27, 2007 at 8:22 PM
the admin menu links are defined in web.sitemap i think. The categorylist should have been fixed and checked in. Strange. The blogroll doesn't check for trust levels any more.
Sep 28, 2007 at 1:47 PM


madskristensen wrote:
the admin menu links are defined in web.sitemap i think. The categorylist should have been fixed and checked in. Strange. The blogroll doesn't check for trust levels any more.


Of course, the web.sitemap - how could I overlook that: thanks, that works too now!

So you think it's strange the blogroll doesn't check for trust levels anymore? To tell you the truth: I'm glad it doesn't!
Sep 30, 2007 at 1:10 AM
Mads, I just updated to the current latest build (4926), and the CategoryList still uses the AppPath. It's in line 89 of /App_Code/Controls/CategoryList.cs

anc.HRef = VirtualPathUtility.ToAbsolute("~/") + "category/" + Utils.RemoveIllegalCharacters(key) + BlogSettings.Instance.FileExtension;

Another reference that slipped my attention earlier, but I notice now: the URL for the RSS feed per author - displays the full AppPath too.
One I did notice, but didn't report (since it's more on a 'per theme' thing), is that the links to Author and Category in the actual post uses the AppPath too. I guess it's a bit more tricky to let those use the 'Utils.RelativeWebRoot'. Less importance (for me at least anyway), since I'll design/create my own theme.


madskristensen wrote:
the admin menu links are defined in web.sitemap i think. The categorylist should have been fixed and checked in. Strange. The blogroll doesn't check for trust levels any more.

Coordinator
Sep 30, 2007 at 8:13 AM
Thanks MikevZ. I must have missed those two. It is fixed now.
Sep 30, 2007 at 2:54 PM
Well my pleasure, but I'd rather thank you :)
Oct 5, 2007 at 10:44 PM
Mads, missed one myself too: the PostViewBase.cs in line 197:

string path = VirtualPathUtility.ToAbsolute("~/category/");

Had to remove the ~ there as well, to prevent the full AppPath showing up in the post.
I patched myself, yet sorry I was too late spotting this one before final 1.2 release.