Virtual Directory not working with RadFileExplorer

4 posts, 0 answers
  1. Bob
    Bob avatar
    3 posts
    Member since:
    Dec 2012

    Posted 28 Dec 2012 Link to this post

    Hello,

    I am working with a c#.Net application locally on my machine.  The application resides in the directory C:\inetpub\wwwroot\appname.

    I have set up a virtual directory in IIS 7 under the application folder with a physical path which is on the SAME machine (my local machine) as the application itself.  The physical path is C:\Data\Test\scans, and the alias I gave the virtual dir is 'scans'.

    I want the files in C:\Data\Test\scans to be shown in the RadFileExplorer I have set up on a page in my application.  This is how I have the RadFileExplorer set up in the codebehind:

    string[] paths = new string[] { "~/scans"  };
    FileExplorer1.Configuration.ViewPaths = paths;

    My issue is that no files show up in the RadFileExplorer!  If I change the above code to this:

    string[] paths = new string[] { "~/"  };
    FileExplorer1.Configuration.ViewPaths = paths;

    Then all of the folders and files in my root (application) directory are shown in the RadFileExplorer, however, the virtual directory is not being shown!

    The RadFileExplorer seems to not be recognizing my virtual directory.  I am using a pass-through authentication in IIS for the virtual directory.  

    Any ideas or thoughts are greatly appreciated!



  2. Vessy
    Admin
    Vessy avatar
    1384 posts

    Posted 02 Jan 2013 Link to this post

    Hi Bob,

    I tried to reproduce the described issue with the latest version of RadControls (2012.3.1205) but to no avail. Which is the version of the controls used in your application?

    Basically the default RadFileExplorer's content provider uses the GetFiles and GetDirectories methods of the System.IO.DirectoryInfo class in order to get the directories/files. If these methods returns the files/folders, then RadFileExplorer should work. as well. You can test the methods by using this test code:
    protected void Page_Load(object sender, EventArgs e)
    {
        string physicalPathToFolder = Server.MapPath("VirtualPathToFolder");
        System.IO.DirectoryInfo dirInfo = new System.IO.DirectoryInfo(physicalPathToFolder);
        System.IO.FileInfo[] files = dirInfo.GetFiles("*.*");
        System.IO.DirectoryInfo[] directories = dirInfo.GetDirectories();
    }

    Another thing I could think of is some kind of permission restrictions. You could see how to test them in the following help article: Troubleshooting.

    Additionally, if non of the above helps in solving the case, I would suggest you to implement a custom FileBrowserContentProvider for directly accessing physical folders. You could use the one from this KB article: Use RadFileExplorer with physical and shared folder's paths.

    Regards,
    Vesi
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Bob
    Bob avatar
    3 posts
    Member since:
    Dec 2012

    Posted 02 Jan 2013 Link to this post

    Hello Vesi,

    Thank you for your reply.  I tried the following method in my code:

    string 
    physicalPathToFolder = Server.MapPath("VirtualPathToFolder");
    System.IO.DirectoryInfo dirInfo = new System.IO.DirectoryInfo(physicalPathToFolder);
    System.IO.FileInfo[] files = dirInfo.GetFiles("*.*");
    System.IO.DirectoryInfo[] directories = dirInfo.GetDirectories();

    And at this line I get an error:

    System.IO.FileInfo[] files = dirInfo.GetFiles("*.*");

    The error is "could not find part of the path 'C:\inetpub\wwwroot\webapplication\scans'."  This makes sense because when I use "~/" as the physical path to the folder, the directories under my web application show up in the file explorer, but the virtual directory does not.

    I tried the permissions link you sent me and am not getting any errors raised.  The file explorer just simply says "no files to display" when using the methods indicated int the troubleshooting link you provided.

    Additionally, I tried the KB article's methods for a custom filebrowsercontentprovider but to no avail yet.  I'm thinking this is a permissions issue but I can't figure out why since this is all occurring on my local machine of which I have full admin rights to.


    Thanks for your help on this.  

  5. Bob
    Bob avatar
    3 posts
    Member since:
    Dec 2012

    Posted 02 Jan 2013 Link to this post

    Ok, so I resolved my problem.  It turns out that my IIS wasn't configured to be used in my Visual Studio setup.  It's always the little things!
Back to Top