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

Forums / Bugs & Issues / External Page Link Issue

External Page Link Issue

15 posts, 0 answered
  1. Chris
    Chris avatar
    5 posts
    Registered:
    09 Jan 2008
    23 Dec 2008
    Link to this post
    I have created a link to an external page with a querystring parameter.  When I click the link on the published site the redirect removes the querystring parameter.  Is there a way to not have the parameter removed?
  2. Pepi
    Pepi avatar
    981 posts
    Registered:
    28 Oct 2016
    23 Dec 2008
    Link to this post
    Hello Chris,

    Unfortunately, we cannot reproduce the described behavior locally. Here is what we have done:
       1. Create a page of type External.
       2. Set External page location property to "http://www.sitefinity.com/support/documentation.aspx?id=1".
       3. In the template drag and drop Site Menu control.

    As a result, clicking on the menu item representing the external page, redirects to the url we have specified as a value of External page location property ("http://www.sitefinity.com/support/documentation.aspx?id=1"). Are we missing something?

    Please, describe in details the exact steps for replicating the issue to figure out what is wrong.

    Best wishes,
    Pepi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Chris
    Chris avatar
    5 posts
    Registered:
    09 Jan 2008
    23 Dec 2008
    Link to this post
    Some more information.  I am building my own menu in the code behind of the Master template for display purposes here is the code.

    Telerik.Cms.CmsManager cmsManager = new Telerik.Cms.CmsManager();
            Telerik.Cms.IRootPage rootPage = cmsManager.GetRootPage();
            IList parentPages = rootPage.Pages;

            for (int i = 0; i < parentPages.Count; i++)
            {
                Telerik.Cms.Data.CmsPage page = (Telerik.Cms.Data.CmsPage)parentPages[i];

                if (page.Navigable)
                {
                    HyperLink hyperLink = new HyperLink();
                    hyperLink.NavigateUrl = page.StaticUrl;
                    hyperLink.Text = page.MenuName;
                    hyperLink.Attributes.Add("class", "menu_unselected");

                    Literal literal = new Literal();
                    literal.Text = "<div class=\"menu_line\"><img src=\"images/spacer.gif\" width=\"160\" height=\"1\" alt=\"\" /></div>";

                    menuItems.Controls.Add(hyperLink);
                    menuItems.Controls.Add(literal);
                }
            }

    If I look at the link it points to the page name I have created.  Alerts.aspx in this case.  But when the link is clicked the redirect removes the querystring parameter I set in the external page link.

    Based on your test I may have to consider switching to the Site Menu control to achieve the redirect.  Based on what I have explained is there a way to do it the way I have it??
  4. Parvan
    Parvan avatar
    151 posts
    Registered:
    24 Sep 2012
    29 Dec 2008
    Link to this post
    Hello Chris,

    Thank you for contacting us.

    You can accomplish your goal with slight changes in your code:
            Telerik.Cms.CmsManager cmsManager = new Telerik.Cms.CmsManager();  
            Telerik.Cms.IRootPage rootPage = cmsManager.GetRootPage();  
            IList parentPages = rootPage.Pages;  
     
            for (int i = 0; i < parentPages.Count; i++)  
            {  
                Telerik.Cms.Data.CmsPage page = (Telerik.Cms.Data.CmsPage)parentPages[i];  
     
                if (page.Navigable)  
                {  
                      
                    HyperLink hyperLink = new HyperLink();  
                    if( page.PageType == Telerik.Cms.CmsPageType.External )  
                    {  
                        hyperLink.NavigateUrl = page.ExternalUrl;  
                    }  
                    else 
                    {  
                        hyperLink.NavigateUrl = page.StaticUrl;  
                    }  
                      
                    hyperLink.Text = page.MenuName;  
                    hyperLink.Attributes.Add("class""menu_unselected");  
     
                    Literal literal = new Literal();  
                    literal.Text = "<div class=\"menu_line\"><img src=\"images/spacer.gif\" width=\"160\" height=\"1\" alt=\"\" /></div>";  
     
                    menuItems.Controls.Add(hyperLink);  
                    menuItems.Controls.Add(literal);  
                }  
            } 

    The idea is if the page is external to use the ExternalUrl property of page object.

    We hope this will help you.

    Regards,
    Parvan
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. Joel Konecny
    Joel Konecny avatar
    11 posts
    Registered:
    20 Mar 2009
    02 Dec 2009
    Link to this post
    I am actually getting the same error with Sitefinity 3.6 out of the box.

    External Page in Sitefinity: http://preview.pfcu.com/sab_copy1.aspx
    Supposed to link to: http://www.priorityresults.com/home.aspx?test=12344
    What you get is: http://www.priorityresults.com/home.aspx

    How do we fix this?

    Brian
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    03 Dec 2009
    Link to this post
    Hi Joel Konecny,

    Your external link does not have any QueryStrings in it. I checked the website and it seems that you are making some loop to the home page and the url is completely differen. Generally you can subscribe for RadMenu ItemDataBound event and change the url or modify the request on your home page.

    CmsSiteMapNode cmsNode = e.Item.DataItem as CmsSiteMapNode;
     if (cmsNode != null && cmsNode.PageType == CmsPageType.External && cmsNode.Url.Contains("copy1"))
     {
         //HERE YOU NEED TO PASS THE FULL URL BECAUSE THERE IS SOME REDIRECT
         e.Item.NavigateUrl = "http://www.priorityresults.com/home.aspx" + "?test=1234";
     }

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  7. Joel Konecny
    Joel Konecny avatar
    11 posts
    Registered:
    20 Mar 2009
    03 Dec 2009
    Link to this post
    Thanks for the quick response Ivan. However, it still strips out the Querystring. Here is the actual example that we are using:
    https://preview.pfcu.com/sab.aspx

    Should redirect to:
    https://secure.andera.com/index.cfm?fiid=337F75BC7E3F40F1A8

    We simply want people to be redirected to the appropriate URL when they go to sab.aspx without having to do any coding. I would expect the external page feature to not strip out the querystring.

    Thanks,

    Brian



  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    03 Dec 2009
    Link to this post
    Hi Joel Konecny,

    The external link just makes a redirect. It is not possible to set any QueryStrings. Possible solutions are

    1. Using the code sample from my previous post.
    2. Handle the request on the other server ( external for Sitefinity) and appending the query string.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  9. Mike Mutek
    Mike Mutek avatar
    15 posts
    Registered:
    03 Dec 2009
    03 Dec 2009
    Link to this post
    Hi Ivan,

    I'm currently working with Joel on this.

    Could you please visit the below URL?  (Just accept the certificate warning if you receive one - site is not live yet)

    https://preview.pfcu.com

    From there, click the "sab" link at the bottom of the navigation.  This link will redirect you to the proper location:
    https://secure.andera.com/index.cfm?fiid=337F75BC7E3F40F1A8

    Now,

    Visit the same page directly by going to:

    https://preview.pfcu.com/sab

    This is the same exact page BUT the page is redirected to https://secure2.andera.com/index.cfm?action=admin.login because the querystring has been removed.

    Why does one way work, and not the other?
  10. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    06 Dec 2009
    Link to this post
    Hi Mike Mutek,

    Ok, I saw the problem now and created a fix. Create a new IHttpModule in App_Code folder as shown below:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.Security;
    using Telerik.Security;
    using Telerik.Cms.Web.UI;
    using Telerik.Cms;
    using Telerik.Cms.Web;
       
    /// <summary>
    /// Summary description for Class5
    /// </summary>
    public class Class5 : IHttpModule
    {
        public Class5()
        {
        }
       
        #region IHttpModule Members
       
        public void Dispose()
        {
              
        }
       
        public void Init(HttpApplication context)
        {
            context.BeginRequest += new EventHandler(context_BeginRequest);
        }
       
          
    void context_BeginRequest(object sender, EventArgs e)
        {
            HttpContext context = HttpContext.Current;
                var manager = new CmsManager();
                CmsSiteMapNode node = (CmsSiteMapNode)SiteMap.Provider.FindSiteMapNode(context);
                if (node != null)
                {
                   Guid id = node.PageID;
                   ICmsPage page = (ICmsPage)manager.GetPage(id);
                   if (page != null && page.PageType == CmsPageType.External)
                   {
                       context.Response.Redirect(page.ExternalUrl);
                   }
                }
        }
       
        #endregion
    }


    Register the module in your web.config file

    <add name="CustomModule" type="Class5, App_Code"/>


    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  11. Mike Mutek
    Mike Mutek avatar
    15 posts
    Registered:
    03 Dec 2009
    07 Dec 2009
    Link to this post
    Ivan,

    Where in the web.config does this module need to be registered?  I've added it to the <modules> section, but I'm not sure that is the correct location because the problem is still occuring.

    Thank you!
    Mike
  12. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    07 Dec 2009
    Link to this post
    Hi Mike Mutek,

    This is standard ASP.NET HttpModule. You can gather more information at MSDN. The module has to be registered under <httpModules> section.


    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  13. Mike Mutek
    Mike Mutek avatar
    15 posts
    Registered:
    03 Dec 2009
    07 Dec 2009
    Link to this post
    Ivan,

    Unfortunately, I haven't been able to get your update to work.  Sorry to bring this up a bit after the fact, but we are running IIS 7.  I knew the following needed to be updated:

    <system.web>
      <httpModules>
      </httpModules>
    </system.web>

    and

    <system.webserver>
      <modules>
      </modules>
    </system.webserver>

    See MSDN

    Please also see attached screenshots of my directory, code file and web.config.

    I'm not receiving any errors, I am just seeing the same behavior as before.

    Please advise,
    Mike
  14. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    07 Dec 2009
    Link to this post
    Hello Mike Mutek,

     If you are running IIS 7 DefaultAppPool you should be able to run the HttpModule registered as shown below.

    <system.webServer>
        <validation validateIntegratedModeConfiguration="false"/>
        <modules runAllManagedModulesForAllRequests="true">
            <remove name="ScriptModule"/>
            <remove name="Cms"/>
            <!--<remove name="LibraryModule"/>-->
            <remove name="RadUploadModule"/>
      <add name="CustomModule" type="Class5, App_Code"/>
            <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add name="Cms" type="Telerik.Cms.Web.CmsHttpModule, Telerik.Cms"/>
            <!-- Http Module for extension mappings in Library module.-->
            <!--<add name="LibraryModule" type="Telerik.Libraries.LibraryHttpModule, Telerik.Libraries"/>-->
            <add name="RadUploadModule" preCondition="managedHandler" type="Telerik.Web.UI.RadUploadHttpModule, Telerik.Web.UI"/>
    </modules>

    Add the module before the default CmsHttpmodule.


    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  15. Mike Mutek
    Mike Mutek avatar
    15 posts
    Registered:
    03 Dec 2009
    07 Dec 2009
    Link to this post
    Ivan,

    Many thanks for your help.  Moving the tag above the default CMS HttpModule worked!

    Thanks!!
    Mike
Register for webinar
15 posts, 0 answered