PDA

View Full Version : retrieve in ASP: XML.sendAndLoad()



Flashmatazz
August 4th, 2005, 04:37 AM
Short question: how would one get the contents of the XML object sent with XML.sendAndLoad within ASP??

Cheers

bandinopla
August 4th, 2005, 03:13 PM
Why U want to do that with asp? And for what?

λ
August 4th, 2005, 03:18 PM
according to google: Requst.BinaryRead (Request.TotalBytes)

Flashmatazz
August 5th, 2005, 02:44 AM
Why U want to do that with asp? And for what?

Well, 'cause I'm building a flash application that needs to send data to the server and for this project we need to use asp. And I also need a response from the server with some data. But I couldn't figure out how to do it with xml.sendAndLoad(). I'm now converting the xml to a string and use a LoadVars object to assign this string to a parameter and send that. I also retrieve data back as a string and use parseXML() to convert it into an XML object again. Bit of a workaround but it works...

@λ: thanks. I also found that but the asp guy wanted me to do it as described above. and since it works it's ok with me.
I just find it strange that there's not something like _POST in PHP that contains all XML data when sending with XML.sendAndLoad()
oh well...

klesk
August 2nd, 2008, 01:42 PM
Hie Flashmatazz, am having a hard time tryin to integrate ur guestbook with .asp, here's what i found:
according λ, it was correct that we need to read the the posted data using Request.BinaryRead (Request.TotalBytes), but we still need some additional codes to convert it to string format, am posting my codes for processXML.asp as below, hope this helps :)


<%
function WriteToFile(FileName, Contents, Append)
on error resume next

if Append = true then
iMode = 8
else
iMode = 2
end If

FileName = Server.MapPath(FileName)

set oFs = server.createobject("Scripting.FileSystemObject")
set oTextFile = oFs.OpenTextFile(FileName , iMode, True)
oTextFile.Write Contents
oTextFile.Close
set oTextFile = nothing
set oFS = nothing

end function

%>

<%

Dim PostData
Dim biData

PostData = ""
biData = Request.BinaryRead(Request.TotalBytes)

For nIndex = 1 to LenB(biData)
PostData = PostData & Chr(AscB(MidB(biData,nIndex,1)))
Next


WriteToFile "guestbook.xml", PostData, false
'response.write Server.MapPath("chat.xml")
response.write PostData
%>