Browse directory of the website aspnet

256 views Asked by At

I want to browse a certain directory of my website(only with folders) and get the path of the selected folder. Then I will use this path to do more things.

Is it possible to read folders from the self website and select a folder and get the path?

1

There are 1 answers

0
dotnetom On BEST ANSWER

If the folder is inside your Web application's sub-folder App_Data, then you can access the list of subfolders by using the following code:

string rootFolder = Server.MapPath("~/App_Data");
string[] folders = Directory.GetDirectories(rootFolder);