Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 20, 2012 07:02 PM by ianaellis
Feb 02, 2012 09:30 AM|LINK
well the problem is that I am new to asp.net technology and I am stuck on a problem.
Now the scenario is that I have to send an HTTPrequest to another server from my page, lets say myGames.aspx and in response to the request the server sends me an XML file. Now I don't know how to handle this situation, I mean I am like a total noob :(
also I don't have just to display the data, I have to send different fields of the XML to different databse tables, but thats a later issue, I'd first like to play with the XML data just on screen.
Feb 02, 2012 11:08 AM|LINK
Just follow this link
i hope it helps you
Feb 02, 2012 11:49 AM|LINK
I googled and tried a lots of approaches but the problem is that my browser isn't displaying the the XML. I just can't catch the data in XML format. if I convert it to string then its printed just fine, but I dont want that, all I want is a solution to HOW
TO HANDLE THE RESPONDED BACK XML FILE AS A RESULT OF HTTP REQUEST.
Feb 02, 2012 11:54 AM|LINK
Which browser you are using IE is Support XML file it will display the xml result.
suppose if you are using any handlers
use this line
context.Response.ContentType = "text/xml";
it ll give you the xml result.
Feb 02, 2012 11:58 AM|LINK
No I dont know how to use handlers
Feb 02, 2012 12:07 PM|LINK
How you send the requset to different server?
would you please post what you get the respose from that server.
it ll easy to guide you.
Feb 02, 2012 12:18 PM|LINK
string url = "http://example.com/CDATA";
WebRequest req = HttpWebRequest.Create("http://example.com/CDATA");
WebResponse res = req.GetResponse();
StreamReader sr = new StreamReader(res.GetResponseStream());
string str = sr.ReadToEnd();
XmlReaderSettings readerSettings = new XmlReaderSettings();
readerSettings.IgnoreWhitespace = true;
XmlReader reader = XmlReader.Create(sr);
//XmlReader reader = XmlReader.Create(str);
//XmlReader reader = XmlReader.Create(url);
it simply gives an error when I try to use the str argument
and this below is the outoput that I get
Feb 02, 2012 12:44 PM|LINK
You need to create the handler for like this
and then create you what ever yiou want
import thing is you need to add
Feb 03, 2012 04:19 AM|LINK
Follow this link
Feb 03, 2012 10:29 PM|LINK
please see this