S
SMH
Hi,
I am making the transition from VB to C#
I am struggling to get my try/catch to work. For some reason, the
exception is not caught. My code is below, any help will be much
appreciated.
Thank you.
Simon.
protected void btnDownloadFile_Click(object sender, EventArgs e)
{
System.Net.WebClient MyClient = new System.Net.WebClient();
for (int i = 0; i < 10; i++) {
try {
MyClient.DownloadFile("http://www.google.co.uk/images/
firefox/fox1.gif", @"C:\afolder\firefox" + i + ".gif");
}
catch (UnauthorizedAccessException aa) {
this.lblException.Text += aa;
}
}
}
I am making the transition from VB to C#
I am struggling to get my try/catch to work. For some reason, the
exception is not caught. My code is below, any help will be much
appreciated.
Thank you.
Simon.
protected void btnDownloadFile_Click(object sender, EventArgs e)
{
System.Net.WebClient MyClient = new System.Net.WebClient();
for (int i = 0; i < 10; i++) {
try {
MyClient.DownloadFile("http://www.google.co.uk/images/
firefox/fox1.gif", @"C:\afolder\firefox" + i + ".gif");
}
catch (UnauthorizedAccessException aa) {
this.lblException.Text += aa;
}
}
}