Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > How to send http post request in ASP

Reply
Thread Tools

How to send http post request in ASP

 
 
inferno2000@my-deja.com
Guest
Posts: n/a
 
      01-26-2006
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?

 
Reply With Quote
 
 
 
 
Marja Ribbers-de Vroed
Guest
Posts: n/a
 
      01-26-2006
<(E-Mail Removed)> wrote in message news:(E-Mail Removed) 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
 
Reply With Quote
 
 
 
 
inferno2000@my-deja.com
Guest
Posts: n/a
 
      01-27-2006

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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Send Basic HTTP authentication credential in the first HTTP request Nacho Nachev ASP .Net Web Services 2 09-05-2012 08:49 PM
How to send a http::get or http::post with a cookie? mrpink Ruby 2 04-22-2007 07:57 AM
How to enter to .aspx page by http connection using http POST request farazkazmi@gmail.com Java 6 08-29-2005 02:58 PM
Pre-Send Request Headers, Pre-Send Request Content =?Utf-8?B?S2V2aW4gQnVydG9u?= ASP .Net 0 12-31-2004 06:29 PM



Advertisments