Sebastian,
If I use the same hosting account with subfolders and alias's, the paths won't be the same until it gets to the /portals/0/
Found this (need to see if this would work with 7 and how to implement it, if so):
http://www.telerik.com/support/kb/aspnet-ajax/editor/stripping-image-and-anchor-paths-in-radeditor.aspx
Stripping image and anchor paths in RadEditor
Strip paths in RadEditor and use relative paths instead of absolute.
BACKGROUND
By default, Internet Explorer (IE) converts all relative links to absolute on the client. This behavior is due to the DOM engine of the Internet Explorer browser which “fills” the paths (href or src) for the objects in an editing area. Since RadEditor relies in most part to the Internet Explorer's engine, one may observe that the editor converts relative paths to absolute after switching to HTML mode and back to edit mode. Actually, it is Internet Explorer which is converting the links. This problem does not apply to NS/Mozilla/Firefox browsers. For v5, Telerik has employed a flexible mechanism based on regular expressions that strips absolute paths. For better performance the mechanism runs only when the user switches to HTML mode or submits the page. The Attribute Inspector module and the link properties dialog show the default href value as it is provided by the browser - that is - they show absolute paths.
SOLUTION
RadEditor for ASP.NET (Classic)
There are many cases where relative paths should be used instead of absolute. For this reason, RadEditor uses two properties which force the links to be stripped on the server. These properties are:
- StripAbsoluteAnchorPaths - specifies whether absolute anchor paths should be stripped (default is true)
- StripAbsoluteImagesPaths - specifies whether absolute images paths should be stripped (default is true)
Since these properties operate on the server, before saving the content, while in HTML mode, one may see absolute links on the client. However, once the page is saved, the paths on the server should be relative.
Example
Lets suppose that we have an image Image.jpg which is located in a folder, named Images on the server, which is under the root of the application MyApplication. By default, the absolute path for that image should be http://localhost/MyApplication/Images/Image.jpg. By setting the StripAbsoluteImagesPaths property to true in the editor's declaration, the path will be stripped to /MyApplication/Images/Image.jpg, i.e.
<radE:RadEditor
id="editor1"
runat="server"
StripAbsoluteImagesPaths="true"
...>
</radE:RadEditor>
In the example above, RadEditor will strip just the server name from the path. In version 5.x of the editor we provided two new properties which one can set to strip the desired portion of the URL path inserted in RadEditor:
-
AnchorPathToStrip - a string representing the path to be stripped from absolute URLs when StripAbsoluteAnchorPaths is true, i.e.
<radE:RadEditor
AnchorPathToStrip="http://PathToStrip/"
StripAbsoluteAnchorPaths="true"
...>
</radE:RadEditor>
(note the slash at the end of the URL)
-
ImagesPathToStrip - a string representing the path to be stripped from absolute URLs of img tags when StripAbsoluteImagesPaths is true, i.e.
<radE:RadEditor
ImagesPathToStrip="http://PathToStrip/"
StripAbsoluteImagesPaths="true"
...>
</radE:RadEditor>
(note the slash at the end of the URL).
We have enhanced the images and anchor stripping mechanism in RadEditor 6.5.1+ and the ImagesPathToStrip and AnchorPathToStrip properties can receive multiple src / href paths to strip divided by a blank space, e.g
ImagesPathToStrip="http://www.domain1.com/wwwtest http://www.domain2.com/wwwtest"
You can put as many src / href paths inside the quotes as many path strings you wish to strip.
The following example demonstrates the URL changing mechanisms of Internet Explorer and RadEditor.
If the RadEditor is placed in a page with URL http://www.telerik.com/management/default.aspx and an anchor with URL "pages/radeditor.aspx" is put on the page using the RadEditor, Internet Explorer will change anchor's URL to http://www.telerik.com/management/pages/radeditor.aspx .
If the StripAbsoluteAnchorPaths property is set to true, the RadEditor will change the anchor's URL to:
AnchorPathToStrip value |
Result URL |
string.Empty (default) |
/management/pages/radeditor.aspx |
http://www.tel |
erik.com/management/pages/radeditor.aspx |
http://www.telerik.com |
/management/pages/radeditor.aspx |
http://www.telerik.com/ |
management/pages/radeditor.aspx |
http://www.telerik.com/management |
/pages/radeditor.aspx |
http://www.telerik.com/management/ |
pages/radeditor.aspx |
http://www.telerik.com/management/pages |
/radeditor.aspx |
http://www.telerik.com/management/pages/ |
radeditor.aspx |
Basically when using RadEditor as a standalone control there are various types of content management environments it can be integrated to. For example, having an edit ASPX page in a subfolder e.g. http://server/edit/editPage.aspx and then viewing the content in http://server/PublicPage.aspx would result in broken links/images in the public page if the path to be stripped is http://server. For this specific scenario the path to be stripped should be http://server/edit.
The resulting paths in the above mentioned scenario would become server-wide absolute ones. However, one might need to have links that are relative to the page. When such a need arises, the path to be stripped should contain the slash, so that relative paths remain only.
Example
If you insert an image, located at
http://localhost/MyApplication/Images/Image.jpg, you will have this whole path in the content area.
If set StripAbsoluteImagesPaths to true and ImagesPathToStrip to http://localhost/MybApplication/, after switching to HTML mode or saving, you will get the path Images/Image.jpg in the content area.
When you switch back to design mode (or you load the content), you will have the path filled back depending on the current page location, i.e. the path will become http://localhost/MyApplication/MyVirtualDirectory/Images/Image.jpg (it will be extended with the Virtual Directory name). However, each time you switch from design mode to html mode and back, you will have the path extended again and again due to a browser limitation.
If you, however, set the ImagesPathToStrip not to contain the slash symbol, e.g. http://localhost/MyApplication, after stripping, the actual image path will become /Images/MyImage.jpg, which will “tell” the browser to look for the image at the WEBSITE_ROOT/Images folder, which will not be correct.
If the images are always located in a subfolder in relation to the current page, you can also set the ImagesPathToStrip in the codebehind to the value of the current page location:
editor1.ImagesPathToStrip = "http://" + Request.ServerVariables["SERVER_NAME"] + Request.CurrentExecutionFilePath
Article relates to
|
RadEditor 5.x+, RadEditor for ASP.NET AJAX
|
Created by
|
Rumen Jekov
|
HOW-TO