13
Answers

Get XML with HttpWebRequest and display results

mike Delvotti

mike Delvotti

13y
9.5k
1

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)