Hi,
I am trying to use a web service on an ISPs server and keep getting the
following message:
"The underlying connection was closed: Unable to connect to the remote server"
Fortunately (so I thought), looking on the web
(http://p2p.wrox.com/topic.asp?TOPIC_ID=4858 for example), this seems to be a
known problem and the solution apparently is to add the following code to the
reference.cs
protected override WebRequest GetWebRequest(Uri uri)
{
HttpWebRequest webRequest = (HttpWebRequest)
base.GetWebRequest(uri);
webRequest.KeepAlive = true;
return webRequest;
}
I have converted this to vb as follows:
Protected Overrides Function GetWebRequest(ByVal Uri As Uri) As
WebRequest
Dim webRequest As HttpWebRequest =
CType(MyBase.GetWebRequest(Uri), HttpWebRequest)
webRequest.KeepAlive = True
Return webRequest
End Function
An import of system.net is also required.
I put this in the reference.vb file accessible from the web references
section of a dll which runs on the client.
Unfortunately this doesn’t have any effect and I am wondering what to do now.
Please could someone give me some suggestions.
Steve Bugden.