Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / February 2008

Tip: Looking for answers? Try searching our database.

Send xml from javascript and recive it from aspx page

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
john.titov@gmail.com - 01 Feb 2008 14:30 GMT
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
bruce barker - 01 Feb 2008 17:11 GMT
the client side javascript did not set a content-length (its a header), so on
the serverside its 0.

-- bruce (sqlwork.com)

> Programming web pages to Microsoft Online Print Wizard. OPW creates
> xml file from transfer manifest of files u select to print
[quoted text clipped - 88 lines]
>
> But Responce write 0  ... can some body help me with this

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.