Hello,
I'm having some problems with my directory path on RadFileExplorer. I'm trying to use the path "\\ftp\ftp\" but it won't load any files or directories, it only loads empty.
Here's some code to analyze:
How come the "\\ftp\ftp\" path doesn't work?
And if I don't comment off the code:
I get an error at:
Saying that oldItem is null.
I don't believe there's anything wrong with the path string, because when I try the follow code:
I get the correct files listed on that path.
I even tried Impersonating an account before using the paths, but it still doesn't work.
I hope there's sufficient information, please help.
Thanks in advance
/Cristoffer
I'm having some problems with my directory path on RadFileExplorer. I'm trying to use the path "\\ftp\ftp\" but it won't load any files or directories, it only loads empty.
Here's some code to analyze:
<telerik:RadFileExplorer ID="FileExplorer1" runat="server" Width="700" Height="500" /> |
if (!IsPostBack) | |
{ | |
FileExplorer1.Configuration.ContentProviderTypeName = typeof(CustomColumnsContentProvider).AssemblyQualifiedName; | |
FileExplorer1.InitialPath = Page.ResolveUrl(@"\\ftp\ftp\" ); | |
FileExplorer1.Configuration.DeletePaths = new string[] { @"\\ftp\ftp\" }; | |
FileExplorer1.Configuration.UploadPaths = new string[] { @"\\ftp\ftp\" }; | |
FileExplorer1.Configuration.ViewPaths = new string[] { @"\\ftp\ftp\" }; | |
} | |
AddDateColumns(); |
public class CustomColumnsContentProvider : FileSystemContentProvider |
{ |
public CustomColumnsContentProvider(HttpContext context, string[] searchPatterns, string[] viewPaths, string[] uploadPaths, string[] deletePaths, string selectedUrl, string selectedItemTag) |
: base(context, searchPatterns, viewPaths, uploadPaths, deletePaths, selectedUrl, selectedItemTag) |
{ |
// Declaring a constructor is required when creating a custom content provider class |
} |
public override DirectoryItem ResolveDirectory(string path) |
{ |
// Update all file items with the additional information (date, owner) |
DirectoryItem oldItem = base.ResolveDirectory(path); |
foreach (FileItem fileItem in oldItem.Files) |
{ |
// Get the information from the physical file |
FileInfo fInfo = new FileInfo(Context.Server.MapPath(VirtualPathUtility.AppendTrailingSlash(oldItem.Path) + fileItem.Name)); |
// Add the information to the attributes collection of the item. It will be automatically picked up by the FileExplorer |
// If the name attribute matches the unique name of a grid column |
fileItem.Attributes.Add("Date", fInfo.CreationTime.ToString()); |
} |
return oldItem; |
} |
public override DirectoryItem ResolveRootDirectoryAsTree(string path) |
{ |
// Update all directory items with the additional information (date, owner) |
DirectoryItem oldItem = base.ResolveRootDirectoryAsTree(path); |
foreach (DirectoryItem dirItem in oldItem.Directories) |
{ |
// Get the information from the physical directory |
DirectoryInfo dInfo = new DirectoryInfo(Context.Server.MapPath(VirtualPathUtility.AppendTrailingSlash(dirItem.Path))); |
// Add the information to the attributes collection of the item. It will be automatically picked up by the FileExplorer |
// If the name attribute matches the unique name of a grid column |
dirItem.Attributes.Add("Date", dInfo.LastWriteTime.ToString()); |
} |
return oldItem; |
} |
} |
How come the "\\ftp\ftp\" path doesn't work?
And if I don't comment off the code:
FileExplorer1.Configuration.ContentProviderTypeName = typeof(CustomColumnsContentProvider).AssemblyQualifiedName; |
I get an error at:
DirectoryItem oldItem = base.ResolveDirectory(path); |
I don't believe there's anything wrong with the path string, because when I try the follow code:
DirectoryInfo di = new DirectoryInfo("\\ftp\ftp\"); |
FileInfo[] rgFiles = di.GetFiles("*.*"); |
foreach(FileInfo fi in rgFiles) |
{ |
Response.Write("<br><a href=" + fi.Name + ">" + fi.Name + "</a>"); |
} |
I even tried Impersonating an account before using the paths, but it still doesn't work.
I hope there's sufficient information, please help.
Thanks in advance
/Cristoffer