Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>HTML (api.aspx)</strong></p> <pre><code>&lt;%@ Page Title="Home Page" Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" ContentType="text/xml" %&gt; </code></pre> <p><strong>CODE BEHIND (api.aspx)</strong></p> <pre><code>public partial class api: System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { getXML(); } public void getXML() { WebRequest req = WebRequest.Create("http://webdev.clic.det.nsw.edu.au/Mum12/Public/Sample.xml"); HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); req.ContentType = "text/xml charset=utf8"; Stream streamdata = resp.GetResponseStream(); StreamReader reader = new StreamReader(streamdata); string serverresponse = reader.ReadToEnd(); reader.Close(); streamdata.Close(); resp.Close(); Response.Write(serverresponse); } } </code></pre> <p>Thats how I have consumed it in test.aspx</p> <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Test" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;script src="Scripts/jquery-1.8.2.min.js" type="text/javascript"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;script&gt; $(document).ready(function () { var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp = new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange = function () { if (xmlhttp.readyState == 4 &amp;&amp; xmlhttp.status == 200) { console.log(xmlhttp.responseXML); } }; xmlhttp.open("GET", "http://localhost/testwebsite/api.aspx", true); xmlhttp.send(); }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I am getting the xml as expected. Please test and let me know if it helps.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload