469,648 Members | 1,398 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

ReadXML through firewall

My firewall appears to be blocking an RSS XML feed from being returned even
thought port 80 is enabled. Can anyone help?

Dim proxyURI As New Uri("http://MyIP:80")

GlobalProxySelection.Select = New WebProxy(proxyURI)

Dim MyXMLDocument As New XPathDocument(http://rss.news.yahoo.com/rss/tech)

Error :

The underlying connection was closed: Unable to connect to the remote server
Nov 22 '05 #1
4 4657

"John" <so*****@msnnotamucho.com> wrote in message
news:ua**************@TK2MSFTNGP11.phx.gbl...
My firewall appears to be blocking an RSS XML feed from being returned even thought port 80 is enabled. Can anyone help?

Dim proxyURI As New Uri("http://MyIP:80")

GlobalProxySelection.Select = New WebProxy(proxyURI)

Dim MyXMLDocument As New XPathDocument(http://rss.news.yahoo.com/rss/tech)

Error :

The underlying connection was closed: Unable to connect to the remote server


I added this to the web.config :

<system.net>

<defaultProxy>

<proxy proxyaddress = "http://127.0.0.1:80" bypassonlocal = "true"/>

</defaultProxy>

</system.net>

And now get this error :

The underlying connection was closed: An unexpected error occurred on a
receive
Nov 22 '05 #2

"John" <so*****@msnnotamucho.com> wrote in message
news:ua**************@TK2MSFTNGP11.phx.gbl...
My firewall appears to be blocking an RSS XML feed from being returned even thought port 80 is enabled. Can anyone help?

Dim proxyURI As New Uri("http://MyIP:80")

GlobalProxySelection.Select = New WebProxy(proxyURI)

Dim MyXMLDocument As New XPathDocument(http://rss.news.yahoo.com/rss/tech)

Error :

The underlying connection was closed: Unable to connect to the remote server


I added this to the web.config :

<system.net>

<defaultProxy>

<proxy proxyaddress = "http://127.0.0.1:80" bypassonlocal = "true"/>

</defaultProxy>

</system.net>

And now get this error :

The underlying connection was closed: An unexpected error occurred on a
receive
Nov 22 '05 #3
If you use WebRequest, you can set the proxy on the request (rather than
globally).
For example, this works for me:

Public Class XpathThruProxy

Private Shared Function GetStreamForUri(Uri As System.String, ProxyUri as
System.String) as System.IO.Stream
Dim req as System.Net.WebRequest
req = System.Net.WebRequest.Create(Uri)
req.Proxy = new System.Net.WebProxy(ProxyUri, true) ' go through a proxy
server
return req.GetResponse().GetResponseStream()
End Function
Public Shared Sub Main()

try
Dim ProxyUri as System.String
ProxyUri= "http://127.0.0.1:3128" ' only if I run a proxy locally
'ProxyUri= "200.244.93.129:3128" ' a remote (working) proxy server

Dim xtr as New
System.Xml.XmlTextReader(GetStreamForUri("http://rss.news.yahoo.com/rss/tech
", ProxyUri))
Dim MyXMLDocument As New System.Xml.XPath.XPathDocument(xtr)

Dim xpn as System.Xml.XPath.XPathNavigator
xpn= MyXMLDocument.CreateNavigator()

Dim expr as System.Xml.XPath.XPathExpression
expr= xpn.Compile("//rss/channel/item")

'Display the selection.
Dim iterator as System.Xml.XPath.XPathNodeIterator = xpn.Select(expr)
while (iterator.MoveNext())
Dim nav2 as System.Xml.XPath.XPathNavigator =
iterator.Current.Clone()
nav2.Select("title")
nav2.MoveToFirstChild()
System.Console.WriteLine(" title: {0}", nav2.Value)
end while

Catch e as System.Exception
System.Console.WriteLine("Exception: " & e.ToString() )

End Try

End Sub

End Class

"John" <so*****@msnnotamucho.com> wrote in message
news:Oq**************@TK2MSFTNGP11.phx.gbl...

"John" <so*****@msnnotamucho.com> wrote in message
news:ua**************@TK2MSFTNGP11.phx.gbl...
My firewall appears to be blocking an RSS XML feed from being returned

even
thought port 80 is enabled. Can anyone help?

Dim proxyURI As New Uri("http://MyIP:80")

GlobalProxySelection.Select = New WebProxy(proxyURI)

Dim MyXMLDocument As New XPathDocument(http://rss.news.yahoo.com/rss/tech)
Error :

The underlying connection was closed: Unable to connect to the remote

server


I added this to the web.config :

<system.net>

<defaultProxy>

<proxy proxyaddress = "http://127.0.0.1:80" bypassonlocal = "true"/>

</defaultProxy>

</system.net>

And now get this error :

The underlying connection was closed: An unexpected error occurred on a
receive

Nov 22 '05 #4
If you use WebRequest, you can set the proxy on the request (rather than
globally).
For example, this works for me:

Public Class XpathThruProxy

Private Shared Function GetStreamForUri(Uri As System.String, ProxyUri as
System.String) as System.IO.Stream
Dim req as System.Net.WebRequest
req = System.Net.WebRequest.Create(Uri)
req.Proxy = new System.Net.WebProxy(ProxyUri, true) ' go through a proxy
server
return req.GetResponse().GetResponseStream()
End Function
Public Shared Sub Main()

try
Dim ProxyUri as System.String
ProxyUri= "http://127.0.0.1:3128" ' only if I run a proxy locally
'ProxyUri= "200.244.93.129:3128" ' a remote (working) proxy server

Dim xtr as New
System.Xml.XmlTextReader(GetStreamForUri("http://rss.news.yahoo.com/rss/tech
", ProxyUri))
Dim MyXMLDocument As New System.Xml.XPath.XPathDocument(xtr)

Dim xpn as System.Xml.XPath.XPathNavigator
xpn= MyXMLDocument.CreateNavigator()

Dim expr as System.Xml.XPath.XPathExpression
expr= xpn.Compile("//rss/channel/item")

'Display the selection.
Dim iterator as System.Xml.XPath.XPathNodeIterator = xpn.Select(expr)
while (iterator.MoveNext())
Dim nav2 as System.Xml.XPath.XPathNavigator =
iterator.Current.Clone()
nav2.Select("title")
nav2.MoveToFirstChild()
System.Console.WriteLine(" title: {0}", nav2.Value)
end while

Catch e as System.Exception
System.Console.WriteLine("Exception: " & e.ToString() )

End Try

End Sub

End Class

"John" <so*****@msnnotamucho.com> wrote in message
news:Oq**************@TK2MSFTNGP11.phx.gbl...

"John" <so*****@msnnotamucho.com> wrote in message
news:ua**************@TK2MSFTNGP11.phx.gbl...
My firewall appears to be blocking an RSS XML feed from being returned

even
thought port 80 is enabled. Can anyone help?

Dim proxyURI As New Uri("http://MyIP:80")

GlobalProxySelection.Select = New WebProxy(proxyURI)

Dim MyXMLDocument As New XPathDocument(http://rss.news.yahoo.com/rss/tech)
Error :

The underlying connection was closed: Unable to connect to the remote

server


I added this to the web.config :

<system.net>

<defaultProxy>

<proxy proxyaddress = "http://127.0.0.1:80" bypassonlocal = "true"/>

</defaultProxy>

</system.net>

And now get this error :

The underlying connection was closed: An unexpected error occurred on a
receive

Nov 22 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by John | last post: by
3 posts views Thread by Raj Chudasama | last post: by
2 posts views Thread by C Glenn | last post: by
2 posts views Thread by Jason Huang | last post: by
1 post views Thread by ray well | last post: by
1 post views Thread by rada.lambretha | 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.