How can I http post data to any page in the web in Classic ASP?
Asked
Active
Viewed 5,317 times
4 Answers
9
I'd suggest ServerXMLHTTP
over XmlHttp
for the reasons below:
XMLHTTP is designed for client applications and relies on URLMon, which is built upon Microsoft Win32 Internet (WinInet). ServerXMLHTTP is designed for server applications and relies on a new HTTP client stack, WinHTTP. ServerXMLHTTP offers reliability and security and is server-safe.
http://support.microsoft.com/kb/290761
Example:
DataToSend = "id=1"
dim xmlhttp
set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP")
xmlhttp.Open "POST","http://localhost/Receiver.asp",false
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlhttp.send DataToSend
Set xmlhttp = nothing

Jakkwylde
- 1,304
- 9
- 16
2
Try this:
Set xmlhttp = Server.CreateObject("Microsoft.ServerXMLHTTP")
xmlhttp.Open "POST", "http://yoursite", false
xmlhttp.Send data
Response.Write xmlhttp.ResponseText

Rubens Farias
- 57,174
- 8
- 131
- 162
-
Don't use XMLHTTP in ASP, use ServerXMLHTTP as @Jakkwylde indicates. – AnthonyWJones Nov 09 '09 at 23:30
-
without adding the content type most posts will not accept this as a valid request – BradLaney Jan 08 '12 at 23:34
0
If you're trying to redirect a POST request, you can use Server.Transfer

Lorraine R.
- 1,545
- 1
- 14
- 39