mike Delvotti

mike Delvotti

  • NA
  • 262
  • 0

Get XML with HttpWebRequest and display results

Aug 27 2011 10:03 AM

Guys I think I'm somewhere near with the below but also way off the mark still, I'm trying to fetch an xml then display the results into a datagrid using the below Webrequest, it doesn't throw an error but then It doesn't display either, am I missing the xml read part or am I overlooking something simple?


HttpWebRequest request = WebRequest.Create(http://myurl/xml) as HttpWebRequest;
               
                
                // Get response  
                using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
                {
                    
                     // Load data into a dataset
                   
                  
                    DataSet dsWeather = new DataSet();
                    dsWeather.ReadXml(response.GetResponseStream());
                   
                      
                   
                    // display dataset information  
                    dataGridView1.DataSource = dsWeather;
                   

                }


Answers (13)