Reading RadEditor content programmatically

2 posts, 1 answers
  1. Sathya
    Sathya avatar
    5 posts
    Member since:
    Mar 2008

    Posted 06 May 2008 Link to this post


    When I read the contents of a page that contains content that uses RadEditor, I realized that the content is encrypted.

    One of our needs is to generate a report with links in each file. Since content from RadEditor is encoded (such as multimedia or flash content embedded using the RadEditor), I am not able to get the references to those links by reading the page.

    Is there an API within RadEditor that would give me the decrypted version of the content so that I can generate a report that tells me all the links within a page?

  2. Answer
    Lini avatar
    2148 posts

    Posted 09 May 2008 Link to this post

    Hi Sathya,

    The API method you need is

    Telerik.SharePoint.EditorTools.UnEscapeSpecialTags(string html)

    However, I think that the EditorTools class is private so you will not be able to use it in this version. Here is the code you can use to decode the editor content:

    public static string DecodeString(string nodeContent)  
            byte[] byteContent = Convert.FromBase64String(nodeContent);  
            string b64Content = System.Text.Encoding.UTF8.GetString(byteContent);  
            return b64Content;  
        catch (Exception)  
            return nodeContent;  
    public static string UnEscapeSpecialTags(string html)  
        MatchEvaluator meTags = new MatchEvaluator(DecodeMatch);  
        string fixedHtml = Regex.Replace(html, "<pre\\s+(style=\"display\\s*:none\"\\s*)?id=\"?RadEditorEncodedTag\"?[^>]*>([^<]+)</pre>", meTags, RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.ECMAScript);  
        return fixedHtml;  
    public static string DecodeMatch(Match m)  
        return DecodeString(m.Groups[2].Value);  

    Simply call UnEscapeSpecialTags() with the editor content.

    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top