-2

In my web application users need to chose folder with special file. But they don't see paths on server. How can I open server folders for viewing? On local machine i look all directories fine: local viewing in web application

On server like this: server viewving in web application

user1848942
  • 355
  • 1
  • 5
  • 21
  • mate you need to provide more context other wise others will give you only vote down not an answer I think this will help you http://stackoverflow.com/questions/6047228/listing-folders-in-a-directory-using-asp-net-and-c-sharp – Kiarash May 15 '13 at 03:43
  • Thanks for the detail I also see you changed the title that's good for the community – Kiarash May 15 '13 at 04:24

1 Answers1

0

call the TreeADirectory with a valid server path and you will have you tree rendered :)

private void TreeADirectory(TreeView treeView, string pathToList)
{
    treeView.Nodes.Clear();
    var rootInfo = new DirectoryInfo(pathToList);
    var node = CreateDirNodes(rootInfo);
    treeView.Nodes.Add(node);
}

private static TreeNode CreateDirNodes(DirectoryInfo directoryInfo)
{
    var directoryNode = new TreeNode(directoryInfo.Name);
    var dirs = directoryInfo.GetDirectories()
    foreach (var directory in dirs)
    {
        directoryNode.Nodes.Add(CreateDirectoryNode(directory));
    }
    //only if you need to show files
    var files = directoryInfo.GetFiles()
    foreach (var file in files )
    {
        directoryNode.Nodes.Add(new TreeNode(file.Name));
    }
    return directoryNode;

}

Kiarash
  • 1,701
  • 2
  • 16
  • 20
  • Thanks but i need another answer. I did directories opening. But directories aren't been showed on my web client when i connect to server – user1848942 May 15 '13 at 05:37
  • You need to show you code then :) how can I guess Please provide your code otherwise no body can help you – Kiarash May 15 '13 at 05:47