469,628 Members | 1,201 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,628 developers. It's quick & easy.

'System.Net.WebException' - Strange Error

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
Nov 20 '05 #1
3 3761
wrGETURL = WebRequest.Create("http:www.cnn.com")

is that a typo?

Greg
"A User" <no****@nowhere.com> wrote in message
news:Xn******************************@216.168.3.30 ...
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

Nov 20 '05 #2
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?

"Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in
news:eN**************@TK2MSFTNGP12.phx.gbl:
wrGETURL = WebRequest.Create("http:www.cnn.com")

is that a typo?

Greg
"A User" <no****@nowhere.com> wrote in message
news:Xn******************************@216.168.3.30 ...
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



Nov 20 '05 #3
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

A User <no****@nowhere.com> wrote in
news:Xn*****************************@216.168.3.30:
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?
"Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in
news:eN**************@TK2MSFTNGP12.phx.gbl:
wrGETURL = WebRequest.Create("http:www.cnn.com")

is that a typo?

Greg
"A User" <no****@nowhere.com> wrote in message
news:Xn******************************@216.168.3.30 ...
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




Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by genc_ ymeri at hotmail dot com | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.