473,574 Members | 5,361 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 2807
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
3253
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
16490
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
3233
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
2087
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
7815
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8258
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
7833
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
6481
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...
1
5635
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5321
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3756
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3770
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1359
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.