illegal characters in ToolsFile path from embedded resource

6 posts, 0 answers
  1. Phil
    Phil avatar
    3 posts
    Member since:
    Oct 2010

    Posted 05 Jan 2011 Link to this post

    I made a custom control which incorporates the RadEditor.  So I end up with a dll (the custom control) which displays the RadEditor control, AND I have to display one set of buttons or another in the RadEditor based on the user's permissions.  I have been able to make the ToolsFile an embedded resource, but the RadEditor throws an ArgumentException when it tries to use the file.

    All of this is working fine if I set the RadEditor1.ToolsFile string like this

    I have to make the ToolsFile an embedded resource so that the files travel w the dll where ever it goes.  I embedded the file and the custom control works fine in the website except that the RadEditor throws an error when it tries to load the ToolsFile: error message =   illegal characters in string

    Belowe is how I call the ToolsFile in that scenario.  It seems to me that the RadEditor is throwing an error when it shouldn't.  I use this same method to set an ImageUrl for an asp:Image and it works fine.  Question: How can I access the path to a RadEditor ToolsFile which is an embedded resource in a custom control.
    RadEditor1.ToolsFile = this.Page.ClientScript.GetWebResourceUrl(typeof (lbWidgets.RootResources), "lbWidgets.RootResources.CourseAuthorTools.xml");
  2. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 10 Jan 2011 Link to this post

    Hi Phil,

    To use embedded resources you need to either implement a custom handler to provide the content of the resource or use the default ASP.NET WebResource.axd handler. If you are using the ASP.NET default resource handler please make sure that you have registered the webresource attribute in the AssemblyInfo.cs file, e.g.:

    [assembly: WebResourceAttribute("MyNameSpace.Resources.ToolsFile.xml", "text/xml")]

    Greetings,
    Dobromir
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  3. Kris
    Kris avatar
    10 posts
    Member since:
    Nov 2009

    Posted 08 Feb 2011 Link to this post

    I am trying to do the same thing and I have added the resource like you suggest however it is still not working.

    [assembly: WebResourceAttribute("ContentEditor.EditorTools.xml", "text/xml")]

    radEditor.ToolsFile = Page.ClientScript.GetWebResourceUrl(this.GetType(), "ContentEditor.EditorTools.xml");

    Here is what is what the actual path looks like:
    "/wwwroot/WebResource.axd?d=v6bGa-tzKYB9YlBOKzzoVIXMPDeVcLkHa-FIE0w8Eiukm1FQi3P88SAFBr6XKS_6Jj4SjbEzb3IAbOBYFwaxgsYcTd4p8hysV2bIUJb_jGPCOalhLWNjakCu6wR2HlPENz7R_diqdX0jcxhnESMDmQ2&t=634327706475139798"

    Error: Illegal Characters in ToolsFile Path.
  4. Phil
    Phil avatar
    3 posts
    Member since:
    Oct 2010

    Posted 09 Feb 2011 Link to this post

    Just to close the loop on my progress/lack of progress on this:   We never did get the file to work as a web resource.  We had to go with a workaround*.

    We are using images, css files, and js files as web resources, registering them in AssemblyInfo.cs and they all work fine.  I think there is a bug involved here.

    It seems to me that the RadEditor doesnt process a web resource file (for its tool bar configuration file) the same way that other parts of SF do, and it ends up choking on the "illegal characters", while other parts of SF accept the file path, and process it correctly.

    _______ _________ ________ _________ __________
    *our workaround was to put the file on the hdd of the website server and get it from there.
  5. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 14 Feb 2011 Link to this post

    Hi,

    Could you please try using the RadEditor's LoadToolsFile(XmlDocument) to load the document from the WebResource instead of the passing it to the ToolsFile property and see if you still experience the same problem? If so, could you please open a formal support tickets and provide a sample projects reproducing the problem so we can investigate it furhter?

    All the best,
    Dobromir
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  6. Kris
    Kris avatar
    10 posts
    Member since:
    Nov 2009

    Posted 18 Feb 2011 Link to this post

                  RadEditor radEditor = new RadEditor();
     
              radEditor.ID = "RadEditorContentasfdsdfas";
       
              radEditor.StripFormattingOptions = EditorStripFormattingOptions.MSWordRemoveAll | EditorStripFormattingOptions.MSWord | EditorStripFormattingOptions.Font |
                                                  EditorStripFormattingOptions.MSWordNoFonts | EditorStripFormattingOptions.Span | EditorStripFormattingOptions.Css;
     
              radEditor.AutoResizeHeight = true;
     
              Stream s = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("BlueK.ContentEditor.EditorTools.xml");
              XmlDocument xml = new XmlDocument(); xml.Load(s);
              radEditor.LoadToolsFile(xml);
     
              radEditor.Content = Content;

    This worked:
    Thanks,
Back to Top