Popular blog tags

The best way to get a directory listing, is to simply do an HTTP request to the URL。 you'd like the directory listing for and to try to parse and extract all of the links from the HTML returned to you.

To parse the HTML links please try to use the HTML Agility Pack. Directory Browsing:

The web server you'd like to list directories from must have directory browsing turned on to get this HTML representation of the files in its directories. So you can only get the directory listing if the HTTP server wants you to be able to. A quick example of the HTML Agility Pack:

HtmlDocument doc = new HtmlDocument();

doc.Load(strURL);

foreach(HtmlNode link in doc.DocumentElement.SelectNodes("//a@href")

{

HtmlAttribute att = link"href";

//do something with att.Value;

}.