webrequest.getResponse() method hangs

P

prakash

Dear ALL

I am write an application for pocketpc . I use visual studio 2003.

I want to get a response string of an ASP web request query

I try this function

Public Shared Function GetResponseStringA(ByVal RemoteURL As String)
As String

Dim StartTime As DateTime = DateTime.Now()
Dim DownloadContent As String
Dim objRequest As Net.WebRequest, objResponse As Net.WebResponse,
objStreamReceive As System.IO.Stream, objEncoding As
System.Text.Encoding, objStreamRead As System.IO.StreamReader

Try
DownloadContent = ""
objRequest = Net.WebRequest.Create(RemoteURL)

objResponse = objRequest.GetResponse
objStreamReceive = objResponse.GetResponseStream
objEncoding = System.Text.Encoding.GetEncoding("utf-8")
objStreamRead = New System.IO.StreamReader(objStreamReceive,
objEncoding)
DownloadContent = objStreamRead.ReadToEnd()

If Not objResponse Is Nothing Then
objResponse.Close()
End If

Return DownloadContent
Catch ex As Exception
msgbox(ex.message)
End Try

End Function
--------------------------------------------------------------

This function works finely for few times

After five or six times . It hangs on the line
objResponse = objRequest.GetResponse.

How to fix that problem
bye
Prakash
 
P

prakash

Dear
Rick Spiewak . It also not working rick . the hang continous rick.
Is There any problem in my machine???
 
R

Rick Spiewak

When I have done this, I used HTTPWebRequest (which inherits from
WebRequest, and is designed for HTTP usage). Try that.
 

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

Top