Convert relative paths to physical paths

Last post 07-12-2005, 9:27 AM by boggey23. 6 replies.
Sort Posts: Previous Next
  •  07-11-2005, 8:21 AM 8567

    Convert relative paths to physical paths

    On a particular area of my site I would like to use CuteEditor simply to display html that is grabbed using the webrequest and webresponse methods from a remote url.

    Things start to go wrong with sites that use relative paths to the images and backgrounds and the editor obviously fails to display the graphics.

    Is there anything built into CuteEditor or anything within the .NET framework that you are aware of that could replace all these relative paths with a physical paths if a base reference is supplied?
     
     
    Any suggestions on this would be much appreciated

    Web Developer
    The Company Formation Wizard -
    Company Registration
  •  07-11-2005, 11:11 AM 8574 in reply to 8567

    Re: Convert relative paths to physical paths

    It looks like you need to convert all the relative URLs to the absolute URLs.
     
    Please Set the UseRelativeLinks property and RemoveServerNamesFromUrl property to false.

    Example:

        Editor1.UseRelativeLinks  = false;
        Editor1.RemoveServerNamesFromUrl = false;
     
    Demo:
     
     
    Hope it helps.
     
    Keep me posted.

     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  07-11-2005, 12:43 PM 8579 in reply to 8574

    Re: Convert relative paths to physical paths

    Thanks Adam,
     
    I managed to solve this by setting the HtmlBase in the PageProperties element.... This worked fine until I upgraded from version 4.0 to 4.5. Now I get the following error message...

    Also how do I programatically set the HtmlBase from within the script?

     
    Parser Error Message: Type 'CuteEditor.Editor' does not have a property named 'PageProperties'.

    Source Error:

    Line 176:      <asp:Panel runat="server" ID="viewHtmlPanel" Visible="false">
    Line 177:        <CE:Editor id="Editor1" EditorWysiwygModeCss="example.css" runat="server" width="520" height="400">
    Line 178:			<PageProperties HtmlBase="http://www.company-wizard.co.uk/"></PageProperties > 
    Line 179:		</CE:Editor> 
    Line 180:		</asp:Panel>

    Source File: D:\WWWRoot\company-wizard.co.uk\www\html\main\design\newEmail.aspx    Line: 178

    Web Developer
    The Company Formation Wizard -
    Company Registration
  •  07-11-2005, 1:03 PM 8580 in reply to 8579

    Re: Convert relative paths to physical paths

    HtmlBase has been removed in the version 4.5.

    Please use the Editor.BaseHref Property instead.

    The Editor.BaseHref Property can be used to set or retrieve the baseline URL on which relative links will be based.
     
    Keep me posted.
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  07-11-2005, 2:24 PM 8585 in reply to 8580

    Re: Convert relative paths to physical paths

    Thanks...

    I'm slowly getting there, I have now managed to configure the Editor to display full paths to the links and images within the imported html. However the editor will not show full paths to images referenced as a table background (e.g. background="../images/back.gif"), is this normal and can I fully resove these paths?

    Also at this stage I am using the editor simply to preview imported html. I have therefore stripped all the controls off the top of the editor, the only thing I cannot yet figure out how to do is configure the editor to fire up in preview mode, do you know if this is possible... to be honest I am not really interested in even displaying the 'Normal' and 'HTML' modes.
     
    Any ideas??

    Web Developer
    The Company Formation Wizard -
    Company Registration
  •  07-12-2005, 9:17 AM 8613 in reply to 8585

    Re: Convert relative paths to physical paths

     boggey23 wrote:
    Thanks...

    I'm slowly getting there, I have now managed to configure the Editor to display full paths to the links and images within the imported html. However the editor will not show full paths to images referenced as a table background (e.g. background="../images/back.gif"), is this normal and can I fully resove these paths?

    Also at this stage I am using the editor simply to preview imported html. I have therefore stripped all the controls off the top of the editor, the only thing I cannot yet figure out how to do is configure the editor to fire up in preview mode, do you know if this is possible... to be honest I am not really interested in even displaying the 'Normal' and 'HTML' modes.
     
    Any ideas??
     
    Forget this... I have developed a workaround, however there is still a problem that I have yet to solve...

    Web Developer
    The Company Formation Wizard -
    Company Registration
  •  07-12-2005, 9:27 AM 8614 in reply to 8613

    Re: Convert relative paths to physical paths

    Okay..
     
    Here is the problem I currently face. After the html has been imported I have developed a script that scans for hrefs, src and background URLs the script then resolves these urls to absolute paths. The string containing the revised html is then dropped into the editor with the EditCompleteDocument value set to true. The result is an editable html page that references images, links and css includes from the domain where it originated from.

    However... the Editor automatically removes the head info which means that the css cannot be referenced. When I try to save the contents of the editor to the local file system using 'Editor1.saveFile(Server.MapPath("savedHTML.html"))' the page looses all of it's CSS formatting... I can't seem to figure out how to resolve this in a practical way?
     
    Any help would be MUCH appreciated...

    Web Developer
    The Company Formation Wizard -
    Company Registration
View as RSS news feed in XML