How to check if a file exists on the web server
<p>I have a file stored on the server and the web page I am populating depends on the fatc that the file exists or not.</p>

<p>How do I test if the file is available on the server?
The file comes on the web page as:
<a href="http://main.server.com/PGT/Reports/ObjectsReport.xml" rel="nofollow">http://main.server.com/PGT/Reports/ObjectsReport.xml</a></p>

<p>I have to test the existence of this file and if it is available I will display a link otherwise I want to hide the link.</p>

<p>The actual path to the server is
//main.server.com/inetpub/wwwroot/PGT/Reports/ObjectsReport.xml
but I don't have access to the server (and therefore to the file) on the network.  I can only access it using the web page.  Is there a way to test that the server has the file or not display the link? (hlObjectsReport.Visible = false;)</p>

<p>I have tried to use the following:</p>

<p>Uri validatedUri;
Uri.TryCreate(uri, UriKind.RelativeOrAbsolute, out validatedUri);</p>

<p>But it returns a valid address even if the file is not there.</p>

<p>Thanks
Tony.</p>
