Home > Forum > ASP.NET > c# read xml from url of website and save it in xml document

c# read xml from url of website and save it in xml document

by rocky   on Mar 03, 2014   Category: ASP.NET  |  Views: 3246    |  Points: 5   |  Starter 
  Reply
i uses http request and response but nothing solve my problem, i want xml data that have its all the element

Bookmark and Share:
 
  User Reply  | Ask a question  |   Reply 
  Re :c# read xml from url of website and save it in xml document   
by Thamil
on Mar 3 2014 12:24PM
Points : 10
Gold 
hi rocky, it seems your query is not clear, can you explain in detail.
  Re :c# read xml from url of website and save it in xml document   
by rocky
on Mar 3 2014 8:57PM
Points : 10
Starter 
thanks Thamilselvan J for interest, now i solve it by myself.......
  Re :c# read xml from url of website and save it in xml document   
by Thamil
on Mar 3 2014 10:53PM
Points : 10
Gold 
hi rocky, In this case is it possible to post the resolution here, so that it would be helpful to everyone.
  Re :c# read xml from url of website and save it in xml document   
by rocky
on Mar 4 2014 12:29AM
Points : 10
Starter 
string url = "say xyz";
XmlDocument doc = new XmlDocument();
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.AllowAutoRedirect = true;
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream resStream = response.GetResponseStream();
StreamReader objSR;
objSR = new StreamReader(resStream, System.Text.Encoding.GetEncoding("utf-8"));
// here i made a mistake but after writing the xml, it got solved
sb.AppendLine("<?xml version = \"1.0\"?>");
string response = sb.ToString();
//"loading xml..."
doc.LoadXml(string.Format("{0}", response));
  Re :c# read xml from url of website and save it in xml document   
by Thamil
on Mar 4 2014 1:24AM
Points : 10
Gold 
Thanks rocky :)

Recent Post

Latest Posts