Hi Patrick,
Cheers for response.
I have been trying what you said and can get the stream to read but
can not see how to write it. I am using the following code and keep
getting the error -
"Stream was not writable."
I see from other messages it may be something to do with 'Keep-alive'
but when i put in that line, it brings back an error. Or it may be
that the write syntax of my code is wrong.
Any help greatly appreciated.
------------------------
<code>
Dim sURL As String
sURL = "http://test.com/rss.xml"
Dim wrGETURL As WebRequest
wrGETURL = WebRequest.Create(sURL)
Dim saByPassList() As String
Dim myProxy As New WebProxy("proxy:8080", True, saByPassList, New
NetworkCredential("user", "password", "_domain"))
myProxy.BypassProxyOnLocal = True
wrGETURL.Proxy = myProxy
Dim objStream As Stream
objStream = wrGETURL.GetResponse.GetResponseStream()
Dim myFileName As String = "C:\rss.xml"
Dim myFileStream As New StreamWriter(objStream)
myFileStream = File.CreateText(myFileName)
</code>
---------------------------------------
Patrick Steele [MVP] <pa*****@mvps.org> wrote in message news:<MP************************@msnews.microsoft. com>...
In article <b3**************************@posting.google.com >, kieran5405
@hotmail.com says... Hi,
I am trying to download a file from the Internet. The below code
works fine with no proxy server but I am behind a proxy server at work
and need to figure out how to include it in the code.
<code>
Dim wc As New System.Net.WebClient
wc.DownloadFile("http://www.google.ie/images/hp0.gif", _
"C:\inetpub\wwwroot\bin\google.gif")
</code>
I have been looking all over google and am trying the following code
but as i am not familar with vb.net i can not get the structure right
or am not sure if this is the way to do it.
<code>
dim ProxyObject as New WebProxy= new
webProxy(Http://proxyserverIP:8080,true)
dim cred as NetworkCredential= new
NetworkCredential("User","password","domain")
ProxyObject.Credentials=cred
GlobalProxySelection.Select=proxyObject
<code>
I've never gove through a proxy, but the above code looks correct.
However, the WebClient class doesn't have a Proxy property but the
WebRequest class does. You may have to use the WebRequest object and
stream the data into the file yourself.