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

Virtual Directory not working with RadFileExplorer

3 Answers 257 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Bob
Top achievements
Rank 1
Bob asked on 28 Dec 2012, 04:07 PM
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!



3 Answers, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 02 Jan 2013, 02:51 PM
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.
0
Bob
Top achievements
Rank 1
answered on 02 Jan 2013, 03:54 PM
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.  

0
Bob
Top achievements
Rank 1
answered on 02 Jan 2013, 07:54 PM
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!
Tags
FileExplorer
Asked by
Bob
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Bob
Top achievements
Rank 1
Share this question
or