I index.html page that post data to page1.asp
page1.asp transform the data and Post it to Page2.asp with this function “PostTo”
Page2.asp is suppose to:
-write the data to data.txt with “WriteToFile”
Problem: WriteToFile function does not write any thing in the file when call from page2
But work when call from page1
Any suggestion?
Function PostTo(Data, URL)
Dim objXMLHTTP, xml
''# On Error Resume Next
Set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
objXMLHTTP.Open "POST", URL, False
objXMLHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objXMLHTTP.Send Data
If objXMLHTTP.readyState <> 4 then
objXMLHTTP.waitForResponse 10
End If
If Err.Number = 0 AND objXMLHTTP.Status = 200 then
PostTo = objXMLHTTP.responseText
else
PostTo = "Failed"
End If
'' # if xhttp.Status<>200 then err.Raise vbObjectError, , "Server returned http code " & xhttp.Status
Set objXMLHTTP = Nothing
End Function
Done.
you should POST to an ASP in a different virtual folder. If the ASP is in the same virtual folder, the ASP stops responding (hangs). After you close the browser, that ASP and other ASPs continue to hang because the request stays queued even though you close the browser. You must restart IIS or restart the computer.