I have used XMLHTTPREQUEST in my previous projects and I would like to
implement the same idea in .NET. I guess the equivalent of it is to use
HTTPWebRequest, the only article I have come accross is the one that
appeared in MSDN magazine (September issue). I could not get it to work, has
anybody implemented it and would like to share their experience.
TIA
Yaz
"Yazid Arezki" <yals...@blueyonder.co.uk> wrote in message
news:umgs526WBHA.2048@tkmsftngp07...
My question was more how would I get the following to work in .NET.
<SCRIPT Language="javascript">
getDetails()
{
var strURL = http://localhost/Test/Details.aspx;
var oHTTP = new ActivexObject("MSXML2.XMLHTTP");
oHTTP.open('GET', strURL,false);
oHTTP.send();
rowTest.InnerHTML = oHTTP.responseXML;
}
</SCRIPT>
<HTML>
...
</HTML>
TIA
Yaz
"Chris Lovett" <clo...@nospam.com> wrote in message
news:3bd5afcd$1...@news.microsoft.com...
I have also used XMLHTTPREQUEST in my previous project.
The client side was a VB COM object to submit to an asp (iis4/iis5) page
unicode xml string.
I am trying to move my VB COM object client to the .net world.
With the following code below. This is working fine with ASCII, so this
may help you to solve your move.
BUT I get errors when I try to work with unicode characteres, the server
side of code is not able to read
correctly the datas from the incoming stream.
Any ideas
// Client Code
string XMLString = "<?xml version=\"1.0\" ?><foo></foo>" ;
System.Uri uriObj = new System.Uri(http://xx/yy.asp);
httpRequest = (HttpWebRequest)WebRequest.CreateDefault(uriObj);
httpRequest.Method = "POST";
httpRequest.ContentType = "text/xml";
httpRequest.Credentials = new System.Net.NetworkCredential("","");
httpRequest.Accept = "*/*";
httpRequest.Headers.Add("Cache-Control","no-cache");
httpRequest.Timeout = 5000;
int BufferSize = 0;
byte[] Buffer = null;
// ASCII
httpRequest.ContentLength = XMLString.Length;
StreamWriter streamw = new
StreamWriter(httpRequest.GetRequestStream(),Encoding.ASCII);
streamw.Write(XMLString);
streamw.Close();
// UNICODE
/*
Buffer = Encoding.Unicode.GetBytes(XMLString);
httpRequest.ContentLength = Buffer.Length;
Stream wreqStream = httpRequest.GetRequestStream();
wreqStream.Write(Buffer, 0, Buffer.Length);
wreqStream.Close();
*/
HttpWebResponse lgResponse = (HttpWebResponse)httpRequest.GetResponse();
Stream stream = lgResponse.GetResponseStream();
BufferSize = (int)httpRequest.ContentLength*3;
Buffer = new byte[BufferSize];
int BytesRead = stream.Read(Buffer, 0, BufferSize);
string Answer = "";
while (BytesRead != 0)
{
Answer += Encoding.Unicode.GetString(Buffer, 0, BytesRead);
BytesRead = stream.Read(Buffer, 0, BufferSize);
}
// Server Side code
<%@Language="VbScript" %>
<%
SET docReceived = Server.CreateObject("Microsoft.XMLDOM")
docReceived.async = False
docReceived.load Request
strDoc docReceived.xml
strDoc = "<?xml version='1.0' encoding='UTF-16'?>" & strDoc
Response.BinaryWrite strDoc
SET docReceived = nothing
response.End
%>
"Yazid Arezki" <yals...@blueyonder.co.uk> wrote in message
news:umgs526WBHA.2048@tkmsftngp07...