How can I make this work
<code>
if (File.Exists(@"http:\\anIpAddress\myfs\test.txt")) label1.Text = "Works!";
else label1.Text = "Nope!";
</code>
I need to use the System.IO methods on files on a server that I access by ip address. If I run this code I get a 'Nope!' every time, but if I navigate in a browser to http:\\anIpAddress\myfs\test.txt it takes me to it just fine. File Sharing is turned on...
Thanks!

System.IO question....
hega72
That's right, the System.IO does not support accessing webfiles directly, what you need to do instead is either user FtpWebRequest/Response in .NET 2.0 or the WebClient classes to access the files on a web server or some server on a different IP outside your network (External)
http://msdn2.microsoft.com/en-us/library/system.net.webclient.aspx
http://msdn2.microsoft.com/en-us/library/system.net.ftpwebresponse.aspx
http://msdn2.microsoft.com/en-us/library/system.net.ftpwebrequest.aspx
if its on the local network then usually you would be able to access it using the UNC path:
\\servername\sharename\file.txt
Dongwei
Its not supported by System.IO namespace's as Ilyas has stated. You need to use WebRequest and WebResponse classes in System.Net namespace.
Best Regards,
TIEN DUC
Hi adwins04,
you cannot use File functions for this. Use System.Net instead.
See http://msdn2.microsoft.com/en-us/library/456dfw4f.aspx for details. You will need to check the HTTP status code of the response. 200-299 is OK, 400-499 will be request errors like not found, no access and so on. 500-599 are server errors.
--
SvenC