I need to create this functionality outside of the IIS with an object - pre
.NET code.
The code below is part of a classic ASP.

<%
Set objHttp = Server.CreateObject("WinHTTP.WinHTTPRequest.5.1")
objHttp.open "POST", www.Microsoft.com/myPage.asp, False
WinHttpRequestOption_SslErrorIgnoreFlags = 4
objHttp.Option(WinHttpRequestOption_SslErrorIgnoreFlags) = &H3300
objHttp.Send "firstName=Dick&lastName=Cheney&status=GodKnows"
sReturnedResponse = objHttp.responseText
%>

So you just cannot do an OLE call ==>
CreateObject("WinHTTP.WinHTTPRequest.5.1") , becuase this object is part of
the IIS server and is isolated, I think.

Does anybody know an Object that is part of the Win 2003 or 2008 (already
installed) but can be called with CreateObject("xxxxx").

Example: MSXML does not work, because you cannot POST the Named pairs
seperately, it has to be part of the URL. And perhaps there is no way of
setting flags like the SslErrorIgnoreFlag
Set XMLHTTP = CreateObject("Msxml2.XMLHTTP")
XMLHTTP.Open "POST", sUrl & "?" & sPairs, False
x = XMLHTTP.send()

Anything will help

RE: Looking for an HTTP Object that works like WinHTTP.WinHTTPRequest. by OldPedant

OldPedant
Thu Jul 10 17:24:16 CDT 2008

Just using MSXML2 wrong.
<%
Set objHttp = Server.CreateObject("msxml2.ServerXMLHTTP")
objHttp.open "POST", "www.Microsoft.com/myPage.asp", False
objHttp.Send "firstName=Dick&lastName=Cheney&status=GodKnows"
sReturnedResponse = objHttp.responseText
%>

Caution: Some servers won't accept the POST from non-browser requestors.
(Ran into that a while back.)

RE: Looking for an HTTP Object that works like WinHTTP.WinHTTPRequest. by OldPedant

OldPedant
Thu Jul 10 17:34:00 CDT 2008

Ugh...just tried my answer on a couple of different sites with no luck.

But others have done this quite successfully. Just answered a post the
other day where a guy did this to hit a credit card processing site.

Double ugh.


RE: Looking for an HTTP Object that works like WinHTTP.WinHTTPRequest. by OldPedant

OldPedant
Thu Jul 10 17:55:04 CDT 2008

Got it!

Forgot about needing to set the Content-Type header value.

Here, you can try it:

Set http = CreateObject("msxml2.ServerXMLHTTP")
http.Open "POST", "http://www.clearviewdesign.com/silly.asp", False
http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
http.Send "id=7&name=barney"
WScript.Echo "Received: " & http.ResponseText



Re: Looking for an HTTP Object that works like WinHTTP.WinHTTPRequest.5.1 by Anthony

Anthony
Fri Jul 11 02:35:49 CDT 2008

"Travis McGee" <travisGatesMcGee@hotmail.com> wrote in message
news:OFIHIEt4IHA.996@TK2MSFTNGP04.phx.gbl...
> I need to create this functionality outside of the IIS with an object -
pre
> .NET code.
> The code below is part of a classic ASP.
>
> <%
> Set objHttp = Server.CreateObject("WinHTTP.WinHTTPRequest.5.1")
> objHttp.open "POST", www.Microsoft.com/myPage.asp, False
> WinHttpRequestOption_SslErrorIgnoreFlags = 4
> objHttp.Option(WinHttpRequestOption_SslErrorIgnoreFlags) = &H3300
> objHttp.Send "firstName=Dick&lastName=Cheney&status=GodKnows"
> sReturnedResponse = objHttp.responseText
> %>
>
> So you just cannot do an OLE call ==>
> CreateObject("WinHTTP.WinHTTPRequest.5.1") , becuase this object is part
of
> the IIS server and is isolated, I think.
>

WinHTTP is pretty ubiquitous these days and is available on all windows
platforms in current support.

> Does anybody know an Object that is part of the Win 2003 or 2008 (already
> installed) but can be called with CreateObject("xxxxx").
>
> Example: MSXML does not work, because you cannot POST the Named pairs
> seperately, it has to be part of the URL. And perhaps there is no way of
> setting flags like the SslErrorIgnoreFlag
> Set XMLHTTP = CreateObject("Msxml2.XMLHTTP")
> XMLHTTP.Open "POST", sUrl & "?" & sPairs, False
> x = XMLHTTP.send()
>
> Anything will help
>

I'm not sure understand your comment about named pairs, its quite common to
use XMLHTTP to emulate a standard HTML Form post which use this sort of
pairing.

However since you need to fiddle with some other request options you can use
WinHTTP. You'll have a problem if the clients are Win95/98 though.


--
Anthony Jones - MVP ASP/ASP.NET



Re: Looking for an HTTP Object that works like WinHTTP.WinHTTPRequ by OldPedant

OldPedant
Fri Jul 11 13:53:03 CDT 2008

"Anthony Jones" wrote:

> I'm not sure understand your comment about named pairs,

I think he simply made the same omission I did. Forgot to add the
Content-Type header:
http.setRequestHeader "Content-Type",
"application/x-www-form-urlencoded"

If you forget that, then indeed the POST does *NOT* work (at least not in
ASP pages). Request.Form is seen as NULL.

So his "named pairs" was just referring to the POST contents, nothing more.