1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Dual Menu Issue (again)

Dual Menu Issue (again)

7 posts, 0 answered
  1. Phill Hodgkinson
    Phill Hodgkinson avatar
    362 posts
    Registered:
    10 Nov 2004
    18 Jun 2009
    Link to this post
    Hi there,

    I'm back to working on an issue I'm having with two menus on my site. Based on other posts I went with the approach of having two top level "group pages" that hold MenuA items and MenuB items. I then drop RadMenu controls on to my page, set the starting node and it works fine. 

    The issue I'm having is that the client has noticed that the urls are now domain.com/MenuA/aboutus.aspx  or domain.com/MenuB/members.aspx  and this isn't acceptable for them. What can I do? Is there a way I could override the url rewriting so that it ignores them? Any thoughts?

    I'm almost thinking that the idea solution (a future feature request) is that it would be nice if Sitefinity could support more than one sitemap file.

    Any help is greatly appreciated.
    Cheers,
    Phill
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    18 Jun 2009
    Link to this post
    Hello Phill Hodgkinson,

    Generally a group page redirects to its first page. So when you click on your MenuA it should redirect to its first page. There is possible way that you can change the url, so that when you click on the group page item you will not be redirected to the first page.

    1, You can use hideUrlForGroupPages - this will remove the link of the Group item.
    2. Add logic to RadMenu_ItemDataBound event and change the url of the group page.

    Sample code:

     public void RadMenu1_ItemDataBound(object sender, RadMenuEventArgs e) 
        { 
            CmsSiteMapNode groupNode = e.Item.DataItem as CmsSiteMapNode; 
            if (groupNode != null && groupNode.PageType == CmsPageType.Group) 
            { 
     
                CmsManager man = new CmsManager(); 
                ICmsPage page = man.GetPage(groupNode.PageID) as ICmsPage; 
                groupNode.Url = "http://www.yahoo.com";           
            } 
        } 

    If your approach is different, let us know.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Phill Hodgkinson
    Phill Hodgkinson avatar
    362 posts
    Registered:
    10 Nov 2004
    18 Jun 2009
    Link to this post
    Hi Ivan,

    Thanks for the reply but your solutions aren't for the problem I'm having. My issue is that the client wants to be able to give someone a url like:
    http://www.domainname.com/members.aspx but if you try to go to that page you get a 404 error becuase the system only knows it as http://www.domainname.com/MenuA/members.aspx

    As you can imaging, emailing out an link that has /MenuA/ in the url isn't clean or clear but I'm really clueless as to get around this. I don't think it's an issue with the RadMenu, it's working just fine (I actually want to jump to first page of groups within my menu) but it's the URL of the actual page that I'm having a problem with.

    Any other ideas?
    Thanks,
    Phill
  4. David
    David avatar
    50 posts
    Registered:
    14 Jan 2009
    18 Jun 2009
    Link to this post
    Hi Phill,

    I believe I ran into a very similar problem on my site. The client requested two distinct menus, one for the very top of the page, and one for them middle of the page. The menus needed to both be dynamically updated as pages were added/modified on the site, but they couldn't share any content. To solve this problem, I also created the site hierarchy around the menus. It looked similar to this:

    Root > TopMenu > Home
                                > About Us
                                > Products
                                > Contact

             > SubMenu > Events
                                > Get Involved
                                > Donate
                                > Jobs

    Similarly, the client had a fit when they saw that the URLs were generating site.com/topmenu/home.aspx, site.com/submenu/jobs.aspx, etc.

    The simplest solution that I found was URL Rewriting, and if you happen to be using IIS7, then you're in luck, because if you download and install the URL Rewrite Module, then you're in business. Check out this page for installation info:  http://learn.iis.net/page.aspx/460/using-url-rewrite-module/

    If you're using IIS6, then I'm not 100% sure how to accomplish this, but I bet this resource is a great place to start. http://www.simple-talk.com/dotnet/asp.net/a-complete-url-rewriting-solution-for-asp.net-2.0/


    I hope this helps!
    David
  5. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    18 Jun 2009
    Link to this post
    Hello David, Phill

    I suggest that you should use Sitefinity's AdvancedUrlRewriter. You can gather more information how to enable it from ourUserManual - URL Rewriting section. You can define different rules depending on your needs.

    sample:

     <rule> 
            <!--<url> will be rewritten to the url in <rewrite> node right after it has been matched.--> 
            <url>Sitefinity/page1\.aspx</url> 
            <rewrite>Sitefinity/group/page1.aspx</rewrite> 
    </rule> 


    Another option is using HttpModule, but in this case  Response.Redirect will be performed and you should have in the root the same page you are looking for. The page should be hidden from the navigation.

    namespace RedirectPages   
    {   
        public class Redirect : IHttpModule   
        {   
            public void Dispose()   
            {   
            }   
      
            public void Init(HttpApplication application)   
            {   
                application.BeginRequest += new EventHandler(application_BeginRequest);   
            }   
      
            void application_BeginRequest(object sender, EventArgs e)   
            {   
                HttpContext context = HttpContext.Current;   
         
                if (context.Request.RawUrl.Contains("/Page/Page.aspx") && context.Items["cmspagemode"] == null)   
                {   
      
                    string newPath = "new_path_here"   
                    context.Response.Redirect(newPath);   
                }   
     
                #region IHttpModule Members   
                #endregion   
            }   
      
        }   
    }    


    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. Phill Hodgkinson
    Phill Hodgkinson avatar
    362 posts
    Registered:
    10 Nov 2004
    18 Jun 2009
    Link to this post
    Thanks again for the feedback.

    Ivan, if I understand you correctly for the rules in the URL Rewriting section I'd have to create a rule for every page in the site? Any time the client adds or removes a page they'd have to tell me so that I can update the web.config file? If this is the case, definitley not an option.
    The second suggestion for writting an HttpModule suggests that I'd have to have a duplicate copy of every page on the site? Once again, the client would create a new page and then have to know to create another at the root and then hide it from navigation? Once again not an option.

    I'm thinking more and more that this should be under feature requests to support more than one site map when building the structure of a site. Can you pass that along to the appropriate place/email?

    Thanks again!
    Phill
  7. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    18 Jun 2009
    Link to this post
    Hello Phill Hodgkinson,

    In AdvancedUrlRewriter you can use rules, conditions and patterns, so you can avoid a lot of the hardcoding. A good option is using an additional url for the pages you want to use. Thus it will be accessible by the additional url as well.
    Example:

    default url:
    ~/Group/pg1.aspx

    additional url
    -~/pg1.aspx

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Register for webinar
7 posts, 0 answered