Reading an Xml file
-
I had created an Xml file using XmlTextwriter in webapplication. like this XmlTextWriter writer = new XmlTextWriter(Server.MapPath("applicant.xml"), Encoding.UTF8); writer.WriteStartDocument(); writer.WriteStartElement("Applicant"); and so on when i click a button ...........Now can i retrieve that xml file in browser when i click a button...........i do not want to bind to any of the asp.net controls. i would like to display that Xml file in browser............. Can anyone help me in this regard.........
-
I had created an Xml file using XmlTextwriter in webapplication. like this XmlTextWriter writer = new XmlTextWriter(Server.MapPath("applicant.xml"), Encoding.UTF8); writer.WriteStartDocument(); writer.WriteStartElement("Applicant"); and so on when i click a button ...........Now can i retrieve that xml file in browser when i click a button...........i do not want to bind to any of the asp.net controls. i would like to display that Xml file in browser............. Can anyone help me in this regard.........
Simplest way I can think of is redirecting the response to the created XML file:
Response.Redirect("applicant.xml");
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
-
I had created an Xml file using XmlTextwriter in webapplication. like this XmlTextWriter writer = new XmlTextWriter(Server.MapPath("applicant.xml"), Encoding.UTF8); writer.WriteStartDocument(); writer.WriteStartElement("Applicant"); and so on when i click a button ...........Now can i retrieve that xml file in browser when i click a button...........i do not want to bind to any of the asp.net controls. i would like to display that Xml file in browser............. Can anyone help me in this regard.........
honeyss wrote:
Now can i retrieve that xml file in browser when i click a button
You do it all in a single request eliminating the writing to disk part. In the button handler event you create a memory rather than disk file XmlTextWriter and then set the Response Content-Type to XML and use Response.Write(...) to return the XML.
led mike