Check URL is exists or not

Hello Friend,

Here we have give simple demo for check URL is exists or not.

we have create one function for check url is valid or not. the function is return true if url is valid else return  false.

Please check below function.

public Boolean checkFileExists(string url)//Pass Url
byte[] fileData = null;
using (WebClient client = new WebClient())
fileData = client.DownloadData(url);
return true;//If url is valid then return true
catch (Exception ex)
return false;// if url is invalid then return false


I hope this function is help you.

No comments

Leave a Reply

8 × = 24