This is a migrated thread and some comments may be shown as answers.

rad editor problem

4 Answers 135 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Umar
Top achievements
Rank 1
Umar asked on 17 Oct 2008, 03:54 PM
hi

i have a radeditor and have set its images path to "~/images" which works fine.

but why wont this work "C:\images"  (not a valid virtual path error)

is there any way around this.

Thanks

4 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 20 Oct 2008, 11:01 AM
Hello Umar,

In particular cases, the nature of ASP.NET and IIS in particular does not permit you to use absolute paths which point outside your application. The ViewPaths and UploadPaths properties are one of these cases - you can use relative paths and/or virtual directories.

The ViewPaths and UploadPaths properties should receive as an argument an array of string paths pointing to folders that should be:
  • a subdirectory of your web application
  • a directory placed in the root of IIS - you can set this folder by using the / forward slash symbol, e.g.
    RadEditor1.ImageManager.UploadPaths  = new String []{"/Images"};
  • a virtual directory of your web application that has a physical path pointing outside of your web application.
  • a shared drive that is a virtual folder of your web application. You can see the following KB article for more information: Uploading images and files to a Shared Drive.
You can find more information here: Uploading images to the server (upload tab is disabled).

Another approach is to implement your custom file system content provider that will be able to read the files for physical resources or virtual folders outside of the web application. You need to override the StoreFile function:

protected void Page_Load(object sender, EventArgs e)
    {
        RadEditor1.ImageManager.ContentProviderTypeName = typeof(myprovider).AssemblyQualifiedName;
    }

    public class myprovider : Telerik.Web.UI.Widgets.FileSystemContentProvider
    {  
      
        public  myprovider(HttpContext context, string[] searchPatterns, string[] viewPaths, string[] uploadPaths, string[] deletePaths, string selectedUrl, string selectedItemTag)
        : base(context, searchPatterns, viewPaths, uploadPaths, deletePaths, selectedUrl, selectedItemTag)
        {
        }

        public override string StoreFile(UploadedFile file, string path, string name, params string[] arguments)
        {
            //code
            return base.StoreFile(file, path, name, arguments);
        }
    }


Best regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Susan
Top achievements
Rank 1
answered on 13 Apr 2009, 04:29 AM
Is this solution posted anywhere in VB? I have looked but cannot seem to find it.

Thanks,
Susan
0
Rumen
Telerik team
answered on 13 Apr 2009, 08:38 AM
Hi Susan,

You can use our online C# to VB.Net converter tool:
http://converter.telerik.com/

All the best,
Rumen
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Susan
Top achievements
Rank 1
answered on 13 Apr 2009, 12:15 PM
Thanks. Worked great.

Susan
Tags
Editor
Asked by
Umar
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Susan
Top achievements
Rank 1
Share this question
or