473,503 Members | 1,625 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(data)
Line 38: Results = reader.ReadToEnd()
I get an error on Line 36, Exception Details: System.Net.WebException:
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.HttpWebRequest.Chec*kFinalStatus()
System.Net.HttpWebRequest.EndG*etResponse(IAsyncRe sult asyncResult)

System.Net.HttpWebRequest.GetR*esponse()
System.Net.WebClient.OpenRead(*String address)
AtomzSearchPOC.Result.Page_Loa*d(Object sender, EventArgs e) in
c:\inetpub\wwwroot\GoogleTest\*Result.aspx.vb:36
System.Web.UI.Control.OnLoad(E*ventArgs e)
System.Web.UI.Control.LoadRecu*rsive()
System.Web.UI.Page.ProcessRequ*estMain()
Any help on resolving this issue would be appreciated

Nov 21 '05 #1
1 2799
Hi,

Try this instead.
Dim wc As New System.Net.WebClient

Dim sr As New System.IO.StreamReader(wc.OpenRead("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.googlegr oups.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(data)
Line 38: Results = reader.ReadToEnd()
I get an error on Line 36, Exception Details: System.Net.WebException:
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.HttpWebRequest.Chec*kFinalStatus()
System.Net.HttpWebRequest.EndG*etResponse(IAsyncRe sult asyncResult)

System.Net.HttpWebRequest.GetR*esponse()
System.Net.WebClient.OpenRead(*String address)
AtomzSearchPOC.Result.Page_Loa*d(Object sender, EventArgs e) in
c:\inetpub\wwwroot\GoogleTest\*Result.aspx.vb:36
System.Web.UI.Control.OnLoad(E*ventArgs e)
System.Web.UI.Control.LoadRecu*rsive()
System.Web.UI.Page.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
3233
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...
0
1087
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...
26
16455
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
3219
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...
2
1682
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? ...
3
4052
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...
3
2085
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...
3
9524
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...
0
7188
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
7313
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...
0
5558
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,...
1
4987
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...
0
4663
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...
0
3156
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...
0
1489
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 ...
1
720
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
366
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...

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.