PC Review


Reply
Thread Tools Rate Thread

Application Hangs When Closing After Successful HTTP Connection

 
 
lostdreamz
Guest
Posts: n/a
 
      19th Oct 2004
I'm able to successfully retrieve a webpage from a web server with a
VB.NET desktop application using (HttpWebRequest/HttpWebResponse), but
when I click the Close button on the application, both it and the
VB.NET debugger hang. I pretty sure I'm closing all the connections
and streams before when this function ends. Any ideas?

If the function below is run before I close the application, then the
application will hang. I have tried the function from 3 different
projects, and only on one of them does the application close without
hanging itself and the debugger.


Public Sub CheckForUpdate()
' objects for writing and reading bytes to streams
Dim objRequest As System.Net.HttpWebRequest
Dim objResponse As System.Net.HttpWebResponse
Dim reader As System.IO.StreamReader
Dim webPage As String
Dim objStream As System.IO.Stream

Try
objRequest =
CType(System.Net.WebRequest.Create("http://192.168.1.102/TBOnline/FileInfo.aspx?version="
& FileVersionInfo.GetVersionInfo("TB.exe").FileVersion),
System.Net.HttpWebRequest)

objResponse =
CType(objRequest.GetResponse,System.Net.HttpWebResponse)
objStream = objResponse.GetResponseStream
reader = New System.IO.StreamReader(objStream)
webPage = reader.ReadToEnd

Catch ex As Exception
MsgBox(ex.Message)
Finally
If Not reader Is Nothing Then reader.Close()
If Not objResponse Is Nothing Then objResponse.Close()
If Not objStream Is Nothing Then objStream.Close()
objResponse.Close()
End Try

End Sub
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
closing connection in web application. archana Microsoft ASP .NET 1 7th Sep 2007 08:59 AM
RDP hangs after successful connection Paul P Windows Vista Networking 3 7th Mar 2007 10:26 PM
dial up internet connection shows disconnected even after successful connection mchael deepak Windows XP General 0 4th Oct 2005 06:48 PM
AIM 5.9 hangs on first run after successful install russ@roy-associates.biz Windows XP General 1 15th Oct 2004 04:08 AM
internet explorer closes window after successful http authentication Eli Windows XP Internet Explorer 1 4th Dec 2003 03:36 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:34 PM.