Send xml from javascript and recive it from aspx page

J

john.titov

Programming web pages to Microsoft Online Print Wizard. OPW creates
xml file from transfer manifest of files u select to print
var xml = window.external.Property("TransferManifest"); // this is xml

so to discribe photos on my aspx page i need to post xml to my page

var XmlHttp;

//Creating and setting the instance of appropriate XMLHTTP Request
object to a "XmlHttp" variable
function CreateXmlHttp()
{
//Creating object of XMLHTTP in IE
try
{
XmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
try
{
XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(oc)
{
XmlHttp = null;
}
}
//Creating object of XMLHTTP in Mozilla and Safari
if(!XmlHttp && typeof XMLHttpRequest != "undefined")
{
XmlHttp = new XMLHttpRequest();
}
}

function window.onload()

{

// enable the Back and Next buttons.

window.external.SetWizardButtons(1, 1, 0);

window.external.SetHeaderText("Zoomin online store",
"Wellcome.");
var xml = window.external.Property("TransferManifest");

var files = xml.selectNodes("transfermanifest/filelist/file");

alert('You are about to upload ' + files.length + '
files.');




CreateXmlHttp()

var requestUrl = 'http://store/Default.aspx' ;
if(XmlHttp)
{

XmlHttp.open("POST", requestUrl, false);
XmlHttp.setRequestHeader("Accept","text/xml");
XmlHttp.setRequestHeader("Cache-Control","no-cache");
XmlHttp.setRequestHeader("SOAPAction",'""');

//
XmlHttp.send(xml);

alert(XmlHttp.statusText);
}

window.location = 'http://store/Default.aspx';
}


And now i need to rtecive it from aspx page


public partial class opw_Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
XmlDocument requestXML = new XmlDocument();
try
{
requestXML.Load(Request.InputStream);
}
catch (XmlException ex)
{
// handle errors here
}
Response.Write(Request.ContentLength);


}


But Responce write 0 ... can some body help me with this
 
B

bruce barker

the client side javascript did not set a content-length (its a header), so on
the serverside its 0.

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top