Invalid site menu links when a page is in a subfolder

This is the place to report bugs and get support. When posting in this forum, please always provide as much detail as possible.

Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum, do not report it as a bug.

This is the place to report bugs and get support

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.
Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum.
This thread is closed to new posts. You must sign in to post in the forums.
6/16/2008 5:42:29 AM
ulu
Gravatar
Total Posts 22

Invalid site menu links when a page is in a subfolder

 Suppose I create a page with an Url like ~/Products/Ivonna.aspx. When I navigate to this page, the top links don't resolve the subfolder: they still look like "Home.aspx" instead of "../Home.aspx" or "/Home.aspx".

The reason is that the menu adapter uses menu.ResolveClientUrl instead of menu.ResolveUrl, and that converts Url from "~/Home.aspx" to "Home.aspx".

Hope that doesn't break anything

 

Index: MenuAdapter.cs
===================================================================
--- MenuAdapter.cs (revision 3844)
+++ MenuAdapter.cs (working copy)
@@ -187,7 +187,7 @@
writer.WriteBeginTag("a");
if (!String.IsNullOrEmpty(item.NavigateUrl))
{
- writer.WriteAttribute("href", Page.Server.HtmlEncode(menu.ResolveClientUrl(item.NavigateUrl)));
+ writer.WriteAttribute("href", Page.Server.HtmlEncode(menu.ResolveUrl(item.NavigateUrl)));
}
else
{
 

 

6/16/2008 6:02:43 AM
Gravatar
Total Posts 18439

Re: Invalid site menu links when a page is in a subfolder

Hi Ulu,

Thanks I'll make the same change here and if I find no issues I'll commit to svn later this afternoon or evening.

Best,

Joe

6/17/2008 5:59:24 AM
ulu
Gravatar
Total Posts 22

Re: Invalid site menu links when a page is in a subfolder

With my solution, the child menu still has problems..

6/17/2008 6:08:26 AM
Gravatar
Total Posts 18439

Re: Invalid site menu links when a page is in a subfolder

Its probably because there is more than one MenuAdapter in the same folder as MenuAdapter.cs and depending on configuration the page menu may be using one of the other ones, possibly TreeViewAdapter.cs or MenuAdapterWithSpanInLinks.cs. I applied your solution to all the menu adapters, not just the one you first mentioned. I don't know if you got my updates but they are in svn trunk.

Best,

Joe

7/4/2008 2:02:39 PM
ulu
Gravatar
Total Posts 22

Re: Invalid site menu links when a page is in a subfolder

Hi,

The site menu works fine, but there's a similar problem with WebControlAdapterExtender (line 121 in the current trunk). As a result, when I'm in a subfolder, the rest of the links in the child menu are invalid.

Here's my patch:

Index: WebControlAdapterExtender.cs
===================================================================
--- WebControlAdapterExtender.cs (revision 3925)
+++ WebControlAdapterExtender.cs (working copy)
@@ -118,7 +118,7 @@
}
else
{
- urlToResolve = AdaptedControl.ResolveClientUrl(urlToResolve);
+ urlToResolve = AdaptedControl.ResolveUrl(urlToResolve);
}

// And, just to be safe, we'll make sure there aren't any troublesome characters in whatever URL
 

7/7/2008 10:24:52 AM
Gravatar
Total Posts 18439

Re: Invalid site menu links when a page is in a subfolder

Hi Ulu,

Thanks for the fix. Its in svn trunk now.

Best,

Joe

You must sign in to post in the forums. This thread is closed to new posts.