By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,127 Members | 1,115 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,127 IT Pros & Developers. It's quick & easy.

How to send http post request in ASP

P: n/a
Let's say if I want to send a http "Post" request to a url, and check
the http status code later. How should I write the code? I have found
example to use WinHttp to send "Get" request and check the http status
code:

======
Set objWinHttp = CreateObject("WinHttp.WinHttpRequest.5")
objWinHttp.Open "GET", strURL
objWinHttp.Send
If objWinHttp.Status <> 200 Then
...
End If
======

How should I write the code if I need to use "POST" to send data in a
form, and to check the http status code later?

Jan 26 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
<in*********@my-deja.com> wrote in message news:11**********************@g44g2000cwa.googlegr oups.com...
Let's say if I want to send a http "Post" request to a url, and check
the http status code later. How should I write the code? I have found
example to use WinHttp to send "Get" request and check the http status
code:

======
Set objWinHttp = CreateObject("WinHttp.WinHttpRequest.5")
objWinHttp.Open "GET", strURL
objWinHttp.Send
If objWinHttp.Status <> 200 Then
...
End If
======

How should I write the code if I need to use "POST" to send data in a
form, and to check the http status code later?


Try something like the following:

Set oXmlHttp = Server.Createobject("MSXML2.ServerXMLHTTP.4.0")
With oXmlHttp
.open "POST", strURL, False
.send strMessageToSend
If (oXmlHttp.status <> 200) Then
' received some other return status, handle it
...
End If
End With
Set oXmlHttp = Nothing

Regards, Marja
Jan 26 '06 #2

P: n/a

Marja Ribbers-de Vroed wrote:
Try something like the following:

Set oXmlHttp = Server.Createobject("MSXML2.ServerXMLHTTP.4.0")
With oXmlHttp
.open "POST", strURL, False
.send strMessageToSend


Thank you, I will try that.

Jan 27 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.