File.Exists checks your hd whether the file is there or not.
Testing whether a file exists on the internet is something completely different.
You might do something with WebRequest, to see if the server is responding...
static bool Exists(string url)
{
try
{
WebRequest wb = WebRequest.Create(url);
using ( WebResponse rp = wb.GetResponse())
{
HttpWebResponse hrp = rp as HttpWebResponse;
if ( hrp != null)
{
return hrp.StatusCode == HttpStatusCode.OK;
}
else
{
return false;
}
}
}
catch( WebException)
{
return false;
}
}
I made a few assumptions here, but it should get you started, then
again getting a file from the internet is really something else as
getting it from your hd...
HTH
// Ryan
On 9/6/06, Lior Levy <[EMAIL PROTECTED]> wrote:
Hello,
I want to determine if a tiff file exists on a url location.
The File Class is no good because the path can't be a url.
only "c:\\MyDir\\MyFile.txt" or "\\\\MyServer\\MyShare"
path = "http://www.serverName.com/folder/aaa.tiff";
lbl_ans.Text = File.Exists(path).ToString();
Any idea?
Thanks,
Lior
===================================
This list is hosted by DevelopMentor(r) http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com
===================================
This list is hosted by DevelopMentorĀ® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com