This how to shows how you can read the XML which is returned by a WebService and displayed in raw XML in IE. fozylet submitted the solution for that question in the asp.net forums. I have converted his VB.NET code to C#.
void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
StreamReader StreamHandler;
XmlDocument xmlDoc = new XmlDocument();
string strURL = "http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate
FromCurrency=INR&ToCurrency=USD";
HttpWebRequest wRequest = (HttpWebRequest)WebRequest.Create(strURL);
wRequest.Headers.Add("Man", "GET " + strURL);
HttpWebResponse wResponse = (HttpWebResponse)wRequest.GetResponse();
if(wRequest.HaveResponse){
if(wResponse.StatusCode == HttpStatusCode.OK){
StreamHandler = new System.IO.StreamReader(wResponse.GetResponseStream());
xmlDoc.LoadXml(StreamHandler.ReadToEnd());
Response.Write(xmlDoc.InnerText);
}
}
}
}
Output
0.0218
Sonu