WebResponse:The remote server returned an error: (404) Not Found ?

  • Thread starter Thread starter MrDeveloper
  • Start date Start date
M

MrDeveloper

First run sucess get data but reply call function (for get refresh data), i
get error.
what I am doing wrong in this code. I get error "The remote server returned
an error: (404) Not Found"

Thanks for helps...

Dim req As WebRequest
Dim rsp As WebResponse
Dim WebData() As String
Dim Temp() As String
Dim Str(2) As String
Dim myitm As ListViewItem
Dim i As Int16


Try

req = WebRequest.Create(http://www.zzz.com/demo.txt)
req.Method = "GET"
rsp = req.GetResponse()

Dim sr As New StreamReader(rsp.GetResponseStream())

WebData = Split(sr.ReadLine(), "-", -1, CompareMethod.Text)

Catch exp As Exception

' Will catch any error that we're not explicitly trapping.

MessageBox.Show(exp.Message)

Finally

Try

' Guarantee the streams will be closed

If Not rsp Is Nothing Then

rsp.GetResponseStream().Close()

End If

Catch ex As Exception

' Eat the error if we get one

MessageBox.Show(ex.Message)


End Try

End Try
 
404 just means that there's no such file (demo.txt in your case) on the server.
 
file demo.txt exist in ftp server...First connection succesfully but refresh
connection get this error..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top