Forums

Skip Navigation LinksHome / Developer Network / Forums / Sitefinity: General Discussions > SiteFinity overtakes my URLS when working with CUSTOM HYPERLINKS IN A CONTROL

SiteFinity overtakes my URLS when working with CUSTOM HYPERLINKS IN A CONTROL

  • Doug Lubey avatar

    Posted on Jan 31, 2012 (permalink)

    This is similar to my image problem with SITE FINITY:
    When working with URL's SiteFinity appears to overtake my URL's.
     
    I am trying to CODE A RELATIVE URL..
    and none of these options work.

    THE URLS eventually look like this (on page render)
    "SITEFINITY CURRENT WEBSITE LOCATION" + the hyperlink text I Add.

    SITE FINITY HIJACKS THE HYPERLINK(s) and PLACES THE PAGES VIRTUAL URL in BEFORE MY URL..... so no matter what I try the HYPERLINK IS MESSED UP.

    Please help with the HIJACKING...

    SEARCH ENGINE INDEX:
    sitefinity url is rewritten
    sitefinity url hyperlink is rewritten
    sitefinity hyperlink <a
    sitefinity relative url links
    sitefinity hyperlinks which are relative to the website domain do not work



    THIS DOES NOT WORK
    e.Row.Cells[3].Text =

     

    "<a href='~" + HttpContext.Current.Request.Url.AbsoluteUri + "?id=" + controlVarCourseId + "&classdate=" + locCurrentDateOfRow + "'>Click here to view the schedule</a>";

     
    THIS DOES NOT WORK
    e.Row.Cells[3].Text =

     

    "<a href='~" + HttpContext.Current.Request.Url.AbsolutePath + "?id=" + controlVarCourseId + "&classdate=" + locCurrentDateOfRow + "'>Click here to view the schedule</a>";

     
    THIS DOES NOT WORK
    e.Row.Cells[3].Text =

     

    "<a href='.." + HttpContext.Current.Request.Url.AbsolutePath + "?id=" + controlVarCourseId + "&classdate=" + locCurrentDateOfRow + "'>Click here to view the schedule</a>";


    THIS DOES NOT WORK

     

    e.Row.Cells[3].Text =

     

    "<a href='~/DougPage.aspx?id=" + controlVarCourseId + "&classdate=" + locCurrentDateOfRow + "'>Click here to view the schedule</a>";






    MORE EXAMPLES  WITH EVERY DECLARED IN THE CONTROL

     

    <br />
    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="../Doug.aspx" >NOT CORRECT http://www.myWebsite.com/UserControls/Doug.aspx<;/asp:HyperLink>
    <br />
    <asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="~/DougTest2.aspx" >CORRECT http://www.myWebsite.com/Doug.aspx<;/asp:HyperLink>

     

     

     

     

     

    <asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="~/DougTest2.aspx" >THIS DEFAULTS TO http://www.myWebsite.com/Doug.aspx</asp:HyperLink>





     

     

    Reply

  • Doug Lubey avatar

    Posted on Jan 31, 2012 (permalink)

    This stinks:  THE ONLY OPTION I HAVE IS TO ENCODE THE FULL-QUALIFIED URL INTO THE HYPERLINK....

    this is the only thing which works:
    e.Row.Cells[3].Text = "<a href='http://" + HttpContext.Current.Request.Url.Host + "/"+ HttpContext.Current.Request.Url.AbsolutePath + "?id=" + controlVarCourseId + "&classdate=" + locCurrentDateOfRow + "'>Click here to view the schedule</a>";



    TELERIK ....QUESTION?
    Why can I not use relative hyperlinks in my controls?

    Reply

  • Lubomir Velkov Lubomir Velkov admin's avatar

    Posted on Feb 2, 2012 (permalink)

    Hello Doug,

    Could you please give us more details about your control that uses these links? Is it a user control, a custom control, some widget that you register in the toolbox? Any additional information would be very helpful.

    All the best,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

    Reply

  • Doug Lubey avatar

    Posted on Feb 2, 2012 (permalink)

    Where does this happen?

    Pretty much anywhere in the VIRTUAL PAGE FRAMEWORK of sitefinity

    This happens in traditional HTML hyerplinks
    This happens in MASTER PAGES which are used as "TEMPLATES" in SiteFinity
    This happens in USER CONTROLS which are registered in the TOOLBOX

    ***** This happens anywhere and everywhere I choose to use a relative link ****


    Reply

  • Doug Lubey avatar

    Posted on Feb 2, 2012 (permalink)

    Here is another example (of a picture link):

    THE ASP.NET CONTROL RELATIVE LINK FOR PICTURES WORKS
    <asp:Image ID="imgLinkUrl" runat="server" ImageUrl="~/App_Themes/Images/LoginSideImages/LoginOnlineTraining.png"  AlternateText="online training" BorderWidth="0px"/>

    While the HTML BASED LINK...does not work
    (Site finity HARD CODES the Virtual path into the URL)
    <img alt="online training logo" src="~/App_Themes/Images/LoginSideImages/LoginOnlineTraining.png" border="0" vspace="0">


    Reply

  • Lubomir Velkov Lubomir Velkov admin's avatar

    Posted on Feb 7, 2012 (permalink)

    Hello Doug,

    I'm not sure I understand - this definition

    <img alt="online training logo"src="~/App_Themes/Images/LoginSideImages/LoginOnlineTraining.png" border="0"vspace="0"> 

    misses a runat="server" tag. Without it the image doesn't render indeed. With it it works perfectly. The rendered HTML path is like this -

    App_Themes/Images/LoginSideImages/a.jpg

    Regards,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

    Reply

  • Doug Lubey avatar

    Posted on Feb 7, 2012 (permalink)

    But when we use standard html tags (either through code behind) or in the standard html markup. Relative links do not work.

    Reply

  • Lubomir Velkov Lubomir Velkov admin's avatar

    Posted on Feb 9, 2012 (permalink)

    Hello Doug,

    I tried the following - created a user control and in the .ascx file I entered this -

    <asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="~/DougTest2.aspx">Test</asp:HyperLink>

    Then I registered the control in the toolbox and dropped it on a page. After publishing and viewing the page the resulted HTML markup was like this -

    <a id="C010_HyperLink2" href="DougTest2.aspx">Test</a>

    Isn't this the behaviour your are looking for?

    All the best,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

    Reply

  • Doug Lubey avatar

    Posted on Feb 9, 2012 (permalink)

    i guess you are missing my point.

    These are not ASP.NET BASED TAGS...
    They are standard html tags (image and hyperlinks)

    -doug

    Reply

  • Lubomir Velkov Lubomir Velkov admin's avatar

    Posted on Feb 14, 2012 (permalink)

    Hello Doug,

    I tried the following - create a folder named "img" and put an image in it named "dogs.jpg". Then I created a master page file with the following markup:

    <a href="dogs.aspx"><img src="img/dogs.jpg" /></a> 

    Then I created a page based on this master page and after viewing the page the output HTML markup was the same as in the original master file.

    Greetings,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

    Reply

  • Doug Lubey avatar

    Posted on Feb 14, 2012 (permalink)

    OK....look at my previous posts. Still not getting it.

    I am using RELATVIE LINKS inside of standard HTML TAGS
    (NOT ABSOLUTE LIKE YOU ARE USING)

    ../../vf1/vf2/dog.aspx
    or
    ~/dog.aspx 
    (symbolizing the file is located on the ROOTof the website...not the virtual directory I am at)

    ~/vf1/vf2/dog.aspx
    (symbolizing the file is located on the in 'vf1/vf2' above the ROOTof the website)




    Reply

  • Lubomir Velkov Lubomir Velkov admin's avatar

    Posted on Feb 17, 2012 (permalink)

    Hello Doug,

    I'm sorry, but I still can't reproduce the behaviour that you describe. I put the following code in a .master file -

    <img src="../NewMed/images/default-album/slide-1.jpg" />

    and when I base a page on this master page and view it the HTML markup is still the same

    <img src="../NewMed/images/default-album/slide-1.jpg" />

    Greetings,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

    Reply

  • Doug Lubey avatar

    Posted on Feb 17, 2012 (permalink)

    The title of this blog is "SiteFinity overtakes my URLS when working with CUSTOM HYPERLINKS IN A CONTROL".....not image tags.

    Please try HYPERLINKS (not image tags)

    Reply

  • Lubomir Velkov Lubomir Velkov admin's avatar

    Posted on Feb 22, 2012 (permalink)

    Hello Doug,

    I tried registering a user control with the following link inside it

    <a href="../Release/Sitefinity">Sitefinity Backend</a>

    When I dropped it on a page and viewed the page the link was exactly the same.

    Kind regards,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

    Reply

  • Doug Lubey avatar

    Posted on Feb 27, 2012 (permalink)

    Ok....it appears it was the difference of a .NET and HTML link

    tilde ONLY WORKS IN FOR A .NET SERVER CONTROL

    use ~ and runat="server" everywhere.
    The tilde (~) character represents the root directory of the application in ASP.NET.
    Exemple: <img runat="server" src="~/Images/imgxx.png" />.
    Problem: Performance is hurt because your image tags are converted to server controls when the page needs to be generated, while there isn't really a need for this.



    Where ../../mylink.htm  will drop you to folders...in STANDARD HTML

    Reply

Skip Navigation LinksHome / Developer Network / Forums / Sitefinity: General Discussions > SiteFinity overtakes my URLS when working with CUSTOM HYPERLINKS IN A CONTROL