BeanSoftware Logo
 

 
ASP.NET Database Search Control
 
 

 
 Home
    Shop
    Advertise
    Write For Us
    Affiliate
    Newsletter
    Contact

How To Get List Of Folders?

To get a list of all sub directories from one location, you can use GetDirectories method, with code like this:

[ C# ]

string[] SiteDirectories =
  System.IO.Directory.GetDirectories(Server.MapPath("~/"));

[ VB.NET ]

Dim SiteDirectories() As String = _
  System.IO.Directory.GetDirectories(Server.MapPath("~/"))

 

Server.MapPath("~/") will simply return root folder of web application. To build more stable application it is recommended to use try-catch block or to check before if directory exists in your specific case.



Related articles:

1. Message Box in ASP.NET 2.0
2. How to select folder with modal FolderBrowserDialog?

FAQ toolbar: Submit FAQ  |  Tell A Friend  |  Add to favorites  |  Feedback



Copyright © 2002-2008 Bean Software. All rights reserved.