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

Forums / 3.x Pre-release forums (retired) / Error when using "~//" in MasterPages

Error when using "~/<dir>/" in MasterPages

4 posts, 0 answered
  1. Ben Alexandra
    Ben Alexandra avatar
    215 posts
    Registered:
    15 Sep 2012
    23 Apr 2007
    Link to this post
    Hi,

    I'm using RC1 and running into an issue. When I use the following code, I get an error (below)

    <asp:HyperLink ID="TopImageLink" runat="server" ImageUrl="~/images/logo.jpg" NavigateUrl="~/index.aspx" />

    If I change the code to just be / it works fine (like so)
    <asp:HyperLink ID="TopImageLink" runat="server" ImageUrl="/images/logo.jpg" NavigateUrl="/index.aspx" />

    Here's the error I get: "Cannot use a leading .. to exit above the top directory."

    Ben

    More...:

     

    Server Error in '/' Application.

    Cannot use a leading .. to exit above the top directory.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Web.HttpException: Cannot use a leading .. to exit above the top directory.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [HttpException (0x80004005): Cannot use a leading .. to exit above the top directory.]
       System.Web.Util.UrlPath.ReduceVirtualPath(String path) +3536158
       System.Web.Util.UrlPath.Reduce(String path) +84
       System.Web.Util.UrlPath.Combine(String appPath, String basepath, String relative) +355
       System.Web.UI.Control.ResolveClientUrl(String relativeUrl) +196
       System.Web.UI.WebControls.Image.AddAttributesToRender(HtmlTextWriter writer) +62
       System.Web.UI.WebControls.WebControl.RenderBeginTag(HtmlTextWriter writer) +17
       System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) +17
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
       System.Web.UI.WebControls.HyperLink.RenderContents(HtmlTextWriter writer) +148
       System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) +29
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +130
       System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +24
       System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +59
       System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +68
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121
       System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +37
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +130
       System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +24
       System.Web.UI.Control.Render(HtmlTextWriter writer) +7
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +130
       System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +24
       System.Web.UI.Page.Render(HtmlTextWriter writer) +26
       Telerik.Cms.Web.CmsPageBase.Render(HtmlTextWriter writer) +70
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121
       System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1896
    


    Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
  2. Rebecca
    Rebecca avatar
    536 posts
    Registered:
    24 Sep 2012
    24 Apr 2007
    Link to this post
    Hello Ben,

    Indeed, the Hyperlink control does not resolve the ImagerUrl property correctly. This is a known issue but we haven't been able to provide a fix for it yet.
    We are sorry for the inconvenience.

    Sincerely yours,
    Rebecca
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Ben Alexandra
    Ben Alexandra avatar
    215 posts
    Registered:
    15 Sep 2012
    23 Jun 2007
    Link to this post
    Hi,

    I figured this issue would have been resolved for the release, but I'm still having the problem.  Seems to only happen once I'm 3 directories in.

    So I have a site and I have a hyperlink image on the template and when I go to edit a page that's 3 dirs in, such as:
    /articles/2005/winter/index.aspx?cmspagemode=edit
    I run into this error.  When I make the hyperlink ImageUrl="/images/edit.gif" instead of ="~/images/edit.gif" it works fine.

    Is this something you could fix for SP1?  I know it's supposed to come out on Tuesday, so it's late notice, but it's a bug that should be fixed, no?

    Thanks a lot.  I LOVE Sitefinity!!!

    Ben
  4. Rebecca
    Rebecca avatar
    536 posts
    Registered:
    24 Sep 2012
    25 Jun 2007
    Link to this post
    Hello Ben Alexandra,

    We fixed this for SP1 by including the DynamicHyperLink control. It does the same job as the Hyperlink control and even if you move a page, all links to it  will still be correct.

    Kind regards,
    Rebecca
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Register for webinar
4 posts, 0 answered