DNN Forums

Ask questions about your website to get help learning DNN and help resolve issues.

Cross portal page (tab) full url

Sort:
You are not authorized to post a reply.





New Around Here





    Hi all,

    I am having trouble trying to get tabs urls. Here is my scenario:

    I have a main portal (id 0) that has a home page (tabid 20). My dev environment has this portal mapped to "http://dnndev.me".

    There is a second portal named Finance thas is configured to be a subdirectory, so this portal is responding on "http://dnndev.me/finance"

    Now I am running code in the finance portal and want to get the url to the homepage of the portal 0.

    My code is as follows:


    int portalId=0;
    var portal = DotNetNuke.Entities.Portals.PortalController.Instance.GetPortal(portalId);
    var homeTabId = portal.HomeTabId; //Returns 20 - OK
    TabInfo tb = DotNetNuke.Entities.Tabs.TabController.Instance.GetTab(homeTabId, portalId);
    var homeTabUrl = DotNetNuke.Common.Globals.NavigateURL(tabId); //Returns "http://dnndev.me/finance/Home" - Wrong
    homeTabUrl = tb.FullUrl; //Returns "http://dnndev.me/finance/Home" - Wrong

    I was expecting the previous code to return something like "http://dnndev.me" or "http://dnndev.me/Home" but it seams it is generation the url using the current portal context instead of using the portal info specified in the secong argument of GetTab.

    Looking on the source code for the TabInfo class - https://github.com/dnnsof...bInfo.cs#L368 - I suspect that the url returned does not take into account the portal that the tab belongs to.

    Anyone has any clues on how to overcome this or any best practice on how to achieve this?

    Thanks!
    Miguel






    Advanced Member





      DNN partner specializing in custom, enterprise DNN development https://engagesoftware.com/showcase





      New Around Here





        Thanks Brian!

        It worked as expected using yout method.

        var portalAliasInfoList = (new DotNetNuke.Entities.Portals.PortalAliasController()).GetPortalAliasesByPortalId(portalId);
                            var portalSettings = new DotNetNuke.Entities.Portals.PortalSettings(tabId, portalAliasInfoList.First());
                            return DotNetNuke.Common.Globals.NavigateURL(tabId, portalSettings, "");

        I am still using the obsolete Globals.NavigateUrl since I am using this code inside a skin object. I will revise this in the future.

        Cheers

        You are not authorized to post a reply.

        These Forums are dedicated to the discussion of DNN Platform.

        For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

        1. If you have (suspected) security issues, please DO NOT post them in the forums but instead follow the official DNN security policy
        2. No Advertising. This includes the promotion of commercial and non-commercial products or services which are not directly related to DNN.
        3. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
        4. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
        5. No Flaming or Trolling.
        6. No Profanity, Racism, or Prejudice.
        7. Site Moderators have the final word on approving / removing a thread or post or comment.
        8. English language posting only, please.

        Would you like to help us?

        Awesome! Simply post in the forums using the link below and we'll get you started.

        Get Involved