473,568 Members | 2,935 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Underlying connection was closed, unable to connect

Jim
I have the following code:
Line 35: Dim sURL As String = "http://www.google.com"
Line 36: Dim data As Stream =
client.OpenRead (Server.UrlPath *Encode(sURL))
Line 37: Dim reader As New StreamReader(da ta)
Line 38: Results = reader.ReadToEn d()
I get an error on Line 36, Exception Details: System.Net.WebE xception:
The underlying connection was closed: Unable to connect to the remote
server.
The stack trace is below:
[WebException: The underlying connection was closed: Unable to connect
to the remote server.]
System.Net.Http WebRequest.Chec *kFinalStatus()
System.Net.Http WebRequest.EndG *etResponse(IAs yncResult asyncResult)

System.Net.Http WebRequest.GetR *esponse()
System.Net.WebC lient.OpenRead( *String address)
AtomzSearchPOC. Result.Page_Loa *d(Object sender, EventArgs e) in
c:\inetpub\wwwr oot\GoogleTest\ *Result.aspx.vb :36
System.Web.UI.C ontrol.OnLoad(E *ventArgs e)
System.Web.UI.C ontrol.LoadRecu *rsive()
System.Web.UI.P age.ProcessRequ *estMain()
Any help on resolving this issue would be appreciated

Nov 21 '05 #1
1 2805
Hi,

Try this instead.
Dim wc As New System.Net.WebC lient

Dim sr As New System.IO.Strea mReader(wc.Open Read("http://news.google.com/"))

Dim strHtml As String

strHtml = sr.ReadToEnd

sr.Close()

wc.Dispose()
Ken
--------------------------
"Jim" <Ji***********@ gmail.com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.com.. .
I have the following code:
Line 35: Dim sURL As String = "http://www.google.com"
Line 36: Dim data As Stream =
client.OpenRead (Server.UrlPath *Encode(sURL))
Line 37: Dim reader As New StreamReader(da ta)
Line 38: Results = reader.ReadToEn d()
I get an error on Line 36, Exception Details: System.Net.WebE xception:
The underlying connection was closed: Unable to connect to the remote
server.
The stack trace is below:
[WebException: The underlying connection was closed: Unable to connect
to the remote server.]
System.Net.Http WebRequest.Chec *kFinalStatus()
System.Net.Http WebRequest.EndG *etResponse(IAs yncResult asyncResult)

System.Net.Http WebRequest.GetR *esponse()
System.Net.WebC lient.OpenRead( *String address)
AtomzSearchPOC. Result.Page_Loa *d(Object sender, EventArgs e) in
c:\inetpub\wwwr oot\GoogleTest\ *Result.aspx.vb :36
System.Web.UI.C ontrol.OnLoad(E *ventArgs e)
System.Web.UI.C ontrol.LoadRecu *rsive()
System.Web.UI.P age.ProcessRequ *estMain()
Any help on resolving this issue would be appreciated
Nov 21 '05 #2

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

Similar topics

22
3246
by: Kristof Thys | last post by:
Hello, I'm developing a C# - windows forms application. To get some information for my application, I'm connecting to an URL, wich gives me XML generated using php. With 90% of the users, this code just works fine: WebRequest request = WebRequest.Create(URL);
0
1095
by: Luis Esteban Valencia | last post by:
I have an application on my intranet It works fine there when I copied the proyect to the server of the Internet it gives me this error. The arquitecture of my servers are. There is one Server for Internet another server for Databases and another server for Intranet. The only one that has public IP is the Internet Server and obviously I...
26
16484
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 Win2K3/IIS6.0), do we still need this patch? 2) Does it specifically solve only this error: The underlying connection was closed. An unexpected error
3
3231
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 posts on this topic but my situation is different. The problem appears to be a setting with my test server. The basic scenario is it works when the...
2
1687
by: geno | last post by:
Hello, When using VB.Net to connect ot a web service, I am getting the error The underlying connection was closed: Unable to connect to the remote server What could be causing this? Thanks!
3
4064
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 from a .NET Web Application hosted on IIS. In our setup the web request form a client can be running for long duration (may be more than 4 hours). ...
3
2086
by: Monty | last post by:
OK, I had an issue with this and found lots of advice that did not apply, so I'm posting what I found hoping it might help someone else. Here's the sitch: you have a COM app that calls to a .Net assembly which in turn calls a web service. You know the web service is reachable and that the COM app is able to instantiate your .Net assembly...
3
9531
by: nandan | last post by:
Yes. My client has a proxy server. That much i know. In my application I make two kinds of calls that are affected by the proxy server I finally got the webservice call working. But my httpwebrequest.GetReponse() function call throws the above error. So here's what i do in the case it works.. //THIS WORKS
0
7605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7917
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8118
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7665
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7962
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6277
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2105
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.