Olá faz vai webrequest
class Program
{
static void Main(string[] args)
{
string urlBase = "http://apptest.net";
string filesFolderUrl = urlBase + "/DirLister";
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(filesFolderUrl);
HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
if (httpWebResponse.StatusCode == HttpStatusCode.OK)
{
Stream rs = httpWebResponse.GetResponseStream();
StreamReader sr = new StreamReader(rs);
StringBuilder sb = new StringBuilder();
char[] read = new Char[256];
int count = sr.Read(read, 0, 256);
while (count > 0)
{
sb.Append(read, 0, count);
count = sr.Read(read, 0, 256);
}
sr.Close();
httpWebResponse.Close();
// Extract <a href=... </a> from html
Regex regEx = new Regex(""\"'](?<url>.*?)[\"\"'].*?>(?.*?)", RegexOptions.Multiline | RegexOptions.IgnoreCase);
MatchCollection matches = regEx.Matches(sb.ToString());
foreach (Match match in matches)
{
// extract href attribute value
string href = Regex.Match(match.Value, "([\"\"'](?<url>.*?)[\"\"'])", RegexOptions.Multiline | RegexOptions.IgnoreCase).Value;
href = href.Replace("\"", "");
// foldernames start and end with / but files only start with /
if (href.StartsWith("/") && !href.EndsWith("/"))
{
string fileToGet = urlBase + href;
Console.WriteLine(fileToGet);
// file download code here...
}
}
}
}
}
Não esqueça de usar o componente </> na barra para posta seu código. Microsoft MCPD,MCTS,MCC