[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

File.Exists Using HTTP

Posted on 2006-04-30
2
Medium Priority
?
1,226 Views
Last Modified: 2008-02-20
Hello,
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("http://www.blah.com/blah.xml") Then
 Return True
Else
 Return False
End If

Is this possible?
0
Comment
Question by:jlm151
2 Comments
 
LVL 6

Accepted Solution

by:
the_paab earned 2000 total points
ID: 16573413
This is example from Microsoft web.

Public Class WebRequestGetExample

    Public Shared Sub Main()
        ' Create a request for the URL.
        Dim request As WebRequest = _
          WebRequest.Create("http://www.blah.com/blah.xml")
        ' 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.
        'reader.Close()
        response.Close()
    End Sub
0
 

Author Comment

by:jlm151
ID: 16574671
Brilliant!

That was exactly what I was looking for. Thanks!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Screencast - Getting to Know the Pipeline
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month19 days, 15 hours left to enroll

873 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