The code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Net;
namespace Battlefield_Servers_Ping
{
public partial class Form1 : Form
{
private string appDirectory;
private string htmlFilesDirectory;
private string localFilename;
private string mainurl;
private string[] serversip;
public Form1()
{
InitializeComponent();
appDirectory = Path.GetDirectoryName(Application.LocalUserAppDataPath);
htmlFilesDirectory = "HtmlFilesDirectory";
htmlFilesDirectory = Path.Combine(appDirectory, htmlFilesDirectory);
Directory.CreateDirectory(htmlFilesDirectory + "\\Tests");
mainurl = "http://www.game-monitor.com/search.php?game=bfbc2&&num=";
using (WebClient client = new WebClient())
{
for (int i = 10; i <= 100; i += 10)
{
client.DownloadFile(mainurl + i, htmlFilesDirectory + "\\Tests\\" + i + ".html");
}
}
}
}
}
In the end i have on the hard disk 10 html files each one is 1kb and inside i see:
[ Access Denied #2 ]
It's not a problem with saving the files they are on the hard disk in the directory i wanted. Could a problem with the site ?
The variable htmlFilesDirectory is:
C:\\Users\\bout0_000\\AppData\\Local\\Tests\\Tests\\HtmlFilesDirectory
The webpage source is:
http://www.game-monitor.com/search.php?game=bfbc2&&num=10
If im in the broswer chrome in this page on empty place make save as i can save the html file no problems. And also edit it later. When im doing save as the name of the file is:
Battlefield Bad Company 2 Servers Server Player Search Game-Monitor.com Server Search, Monitoring, Stats and more
But in my program im saving it diffrenet. The address is different.