|
-
June 30th, 2010, 05:33 PM
#1
System.Net.WebException was unhandled
Hey guys I really need some help I have spent hours trying to fiddle this code,
I have this:-
Code:
System.Net.WebClient client= new System.Net.WebClient();
client.DownloadFile("http://localhost/test.txt", string.Concat("C:/test.txt"));
ok so that works fine, but I want it so that IF the file did not exist, it would have a message box poping up saying the file could not be found rather than getting a horrible message as such:-
The remote server returned an error. (404) Not Found.
I know the file doesnt' exist when I remove it from localhost, but I want to know how to verify whether or not the file exists befpre downloading, or something to give me the ability to handle custom errors!
Cheers in advance!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|