2

How can I http post data to any page in the web in Classic ASP?

skaffman
  • 398,947
  • 96
  • 818
  • 769
Alon Gubkin
  • 56,458
  • 54
  • 195
  • 288

4 Answers4

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

Please see:

System.Net.HttpWebRequest in classic asp?

Community
  • 1
  • 1
Mitch Wheat
  • 295,962
  • 43
  • 465
  • 541
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
0

If you're trying to redirect a POST request, you can use Server.Transfer

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