473,407 Members | 2,598 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

The underlying connection was closed

Hi !
When i try to use webrequest class i get this error

The underlying connection was closed: An unexpected error occurred on a
receive.

I ma uisng vb.net and have no control on the server Can any one tell me how
i do fix that form my code?

Thanks
Suhail Kaleem
Nov 21 '05 #1
3 1679
"Suhail Kaleem" <su**********@mailyoulike.com> schrieb:
When i try to use webrequest class i get this error

The underlying connection was closed: An unexpected error occurred on a
receive.

I ma uisng vb.net and have no control on the server Can any one tell me
how i do fix that form my code?


Does this only occur with a specific server only?

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #2
Hi !
I get this problem on localhost (IIS) and also on web with my
host !

Thanks
Suhail kaleem
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:On**************@TK2MSFTNGP10.phx.gbl...
"Suhail Kaleem" <su**********@mailyoulike.com> schrieb:
When i try to use webrequest class i get this error

The underlying connection was closed: An unexpected error occurred on a
receive.

I ma uisng vb.net and have no control on the server Can any one tell me
how i do fix that form my code?


Does this only occur with a specific server only?

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3
Here is the code

Function get_web_data(ByVal url)
Dim html
' Debug.WriteLine(url)

'Create a WebRequest
Dim wrRequest As WebRequest
wrRequest = WebRequest.Create(url)

'Get the Response from the Request
Dim wrResponse As WebResponse = wrRequest.GetResponse()

'Read the Response into a stream and output the stream
Dim objStream As Stream = wrResponse.GetResponseStream()
Dim objStreamReader As StreamReader = New StreamReader(objStream)
Try
html += objStreamReader.ReadToEnd()
wrRequest.Abort()
objStream.Close()
objStreamReader.Close()

Catch ex As Exception
wrRequest.Abort()
objStream.Close()
objStreamReader.Close()
get_web_data = "Error: " & ex.Message.ToString
Exit Function
End Try

get_web_data = html
Debug.WriteLine(html)

End Function


"Suhail Kaleem" <su**********@mailyoulike.com> wrote in message
news:OL**************@TK2MSFTNGP15.phx.gbl...
Hi !
I get this problem on localhost (IIS) and also on web with my
host !

Thanks
Suhail kaleem
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:On**************@TK2MSFTNGP10.phx.gbl...
"Suhail Kaleem" <su**********@mailyoulike.com> schrieb:
When i try to use webrequest class i get this error

The underlying connection was closed: An unexpected error occurred on a
receive.

I ma uisng vb.net and have no control on the server Can any one tell me
how i do fix that form my code?


Does this only occur with a specific server only?

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>


Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

26
by: Rajeev Tipnis | last post by:
http://support.microsoft.com/default.aspx?scid=kb;en- us;819450 Questions: 1) Is this patch (fix) applicable to the .NET 1.1 Framework as well? That is, if we have Framework 1.1 (On...
3
by: MattM | last post by:
I am getting the "The underlying connection was closed: Unable to connect to the remote server" message when trying to connect an ASPX page to a simple Hello World web service. I have read a few...
5
by: Vijayakrishna Pondala | last post by:
Hi, We are using the following error randomly, when accessing a webservice method/servlet hosted on JBoss application server: The underlying connection was closed: An unexpected error occurred...
4
by: Matthew.DelVecchio | last post by:
hello, i am developing an ASP.NET web app that consumes a 3rd party vendor webservice. it is my first one so while ive done my homework, im not an expert on the matter. our partner's...
2
by: hazz | last post by:
Dim ws As New GetInfoByZIP.USZip works great if I have an internet connection on my dev machine. As soon as I lose or disable my internet connection I get "The underlying connection was...
1
by: Tim Reynolds | last post by:
Team, From a windows service, we consume a web service on another server and occasionally receive System.Net.WebException: The underlying connection was closed:. For some clients we call, we do...
3
by: Rahul Anand | last post by:
As per our requirements we have a web service which internally connects (Simple HTTP Post Request) to a remote server to initiate some work. We are calling the web service method asynchronously...
2
by: =?Utf-8?B?RnJpZWRoZWxtRWljaGlu?= | last post by:
I am consuming continously my own web-services on a localhost client with a rate of perhaps 35 request/response-pairs a minute. I am using "invoke-id=1", so there is at the same time only one...
4
by: =?Utf-8?B?QXJuYXVkIFZpc2N1c2k=?= | last post by:
Hi all, we meet a problem since we use WCF to consume java WebServices. Often the first call works then the second raises the following error : "The underlying connection was closed : " We...
4
by: Sin Jeong-hun | last post by:
I don't get the message so it's hard to debug that, but some of my clients report that they get "The underlying connection was closed unexpectedly" exception. According to this site (http://...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.