save an xml stream to a file

K

kieran

Hi,

I am trying to download a file through a proxy which is causing me
lots of permission erors.

anyway after hacking at any and all code i could get my hands on, i
got this far, where the xml file is in the sLine stream. now i want
to save this stream to a local xml file but am having trouble doing
this.

<code>
Dim sURL As String
sURL = "http://test/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
'wrGETURL.Proxy = WebProxy.GetDefaultProxy()

Dim objStream As Stream
objStream = wrGETURL.GetResponse.GetResponseStream()

Dim objReader As New StreamReader(objStream)
Dim sLine As String = ""
Dim i As Integer = 0

Do While Not sLine Is Nothing
i += 1
sLine = objReader.ReadLine
If Not sLine Is Nothing Then
Console.WriteLine("{0}:{1}", i, sLine)
End If
Loop

Console.ReadLine()

</code>

Does anyone have any ideas for this.
 

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