'System.Net.WebException' - Strange Error

A

A User

Very strange - this code is copy and paste from the net and works on 2 of
my 3 development machines - but of course not the machine I need to run it
on.

I've seen similar posts, but no solutions that work for me. Is it a problem
with my proxy settings on this 1 machine? I have all the boxes unchecked
for LAN Settings. Net browsing is fine. Other machines are the same.

The error is:
An unhandled exception of type 'System.Net.WebException' occurred in
system.dll

Additional information: The underlying connection was closed: The remote
name could not be resolved.


Code for form load:

'Create a new WebRequest object, which can only be done through the
static Create method of the WebRequest class
Dim wrGETURL As WebRequest
wrGETURL = WebRequest.Create("http:www.cnn.com")

'use whatever settings have been configured in Internet Explorer
wrGETURL.Proxy = WebProxy.GetDefaultProxy()

'use it to obtain a Stream object corresponding to the response to
your request.
Dim objStream As Stream
objStream = wrGETURL.GetResponse.GetResponseStream()

'After you have the response stream, you can treat it like any
other stream (such as from opening a text file) and read through its
contents line by line or even all at once. The loop below reads the stream
one line at a time until the ReadLine method returns Nothing, outputting
each line to the console.
Dim objReader As New StreamReader(objStream)
Dim i As Integer = 0

Me.TextBox1.Text = objReader.ReadToEnd
 
A

A User

Indeed that is a typo - and the url does not matter as I've tried a
whole bunch. The problem is exactly as outlined though. Can anyone help?
 
A

Anonymous

I am so happy - it was ZoneAlarm. I uninstalled and everything is fine
now.

I didn't know it because I wasn't even running it - I has it NOT running
on startup so I thought it was totally off, but it must still do
something with the network stack or something. Anyway it all works now!

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top