File.Exists Using HTTP

Posted on 2006-04-30
Last Modified: 2008-02-20
I'm trying to use file exists on an xml doc that's accessible through the web. I know the file is there but it still returns false each time.

If file.exists("") Then
 Return True
 Return False
End If

Is this possible?
Question by:jlm151
    LVL 6

    Accepted Solution

    This is example from Microsoft web.

    Public Class WebRequestGetExample

        Public Shared Sub Main()
            ' Create a request for the URL.
            Dim request As WebRequest = _
            ' If required by the server, set the credentials.
            request.Credentials = CredentialCache.DefaultCredentials
            ' Get the response.
            Dim response As WebResponse = request.GetResponse()
            ' Display the status.
            ' Get the stream containing content returned by the server.

            Dim Status As String = CType(response, HttpWebResponse).StatusDescription
            If Status = "OK" Then
                'file exists          
            End If

            'Dim dataStream As Stream = response.GetResponseStream()
            ' Open the stream using a StreamReader for easy access.
            'Dim reader As New StreamReader(dataStream)
            ' Read the content.
            'Dim responseFromServer As String = reader.ReadToEnd()
            ' Display the content.

            ' Clean up the streams and the response.
        End Sub

    Author Comment


    That was exactly what I was looking for. Thanks!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Suggested Solutions

    I have developed many web applications with asp & and to add and use a dropdownlist was always a very simple task, but with the new, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
    One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on could not pull conte…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now