I am using website which has some traffic values inside. When i connected to site(with any browser) it ask for pass and username. Even if i put true pass and username it is asking again pass and username. After putting pass and username second time with same username and pass, website giving access(i know this is web site issue but i need to resolve it in my code).
For this reason at my application side downloading empty files.Not giving any errors or something.
Here is my code:
try
{
WebClient webClient = new WebClient();
webClient.Credentials = new NetworkCredential("username", "pass");
webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(DownloadCompleted);
webClient.UseDefaultCredentials = true;
webClient.DownloadFileAsync(new Uri("http://examplewebsite.com/trafikdata/xml/speeds.xml"), @"speeds\" + CreateFilename());
}
catch (WebException Ex)
{
btn_Update.Text = "UPDATE";
Bekle.Visible = false;
MessageBox.Show("Download Edilemedi!"+Ex.Message);
}
Is there a way to send credential second time or another way to get throught?