I know I can locally, on my filesystem, check if a file exists:
if(File.Exists(path))
Can I check at a particular remote URL?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you’re attempting to verify the existence of a web resource, I would recommend using the
HttpWebRequestclass. This will allow you to send aHEADrequest to the URL in question. Only the response headers will be returned, even if the resource exists.Of course, if you want to download the resource if it exists it would most likely be more efficient to send a
GETrequest instead (by not setting theMethodproperty to"HEAD", or by using theWebClientclass).