[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Save HttpWebResponse XML file to Local Computer

Posted on 2007-11-15
2
Medium Priority
?
1,129 Views
Last Modified: 2013-11-26
Hi,

I "get" (download) a XML file using the code listed below.

How can I save that to a local file? For the life of me I can't figure it out.

Thanks
Dim wr As HttpWebRequest = _
                CType(WebRequest.Create("http://thewebsite.com/thexmlfile.xml"), HttpWebRequest)
        Dim wrp As HttpWebResponse = CType(wr.GetResponse, HttpWebResponse)
        Dim s As Stream = wrp.GetResponseStream

Open in new window

0
Comment
Question by:ALawrence007
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 23

Accepted Solution

by:
Snarf0001 earned 2000 total points
ID: 20289974
Use streamreader and streamwriter objects
I use c# instead of VB, so forgive me if syntax is off a bit, but something like the following:

Dim wr as HttpWebRequest = HttpWebRequest.Create("http://thewebsite.com/thexmlfile.xml")
Dim wrp as HttpWebResponse = wr.GetResponse

Dim sr as StreamReader = new StreamReader(wrp.GetResponseStream)
Dim sw as StreamWriter = new StreamWriter("thelocalxmlfile.xml", false)
sw.Write(sr.ReadToEnd)
sr.Close
sw.Close
0
 

Author Comment

by:ALawrence007
ID: 20291308
Thanks Snarf0001!
Worked like a charm!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question