p2p.wrox.com Forums

Need to download code?

View our list of code downloads.

  Return to Index  

asp_components thread: Re: Using a Microsoft's winHTTP to send HTTPS request from an ASP page ?

Message #1 by webmaster@c... on Thu, 21 Mar 2002 20:26:08
The Following is a scrap of code from a Component I wrote for a Demo

   I am posting an XML string from this Component (just like submitting a form) across the internet TO AN ASP page (POSTUPDATE.asp).
   The XML is just put into querystring.

    That ASP page on the webserver calls a component  that reads in the XML, updates database, etc.....
    Basiclly is an VERY informal "Web Service" - making proceedure call across internet.

Private Function HTTPSubmit(ByVal XMLstring As String) As Boolean
    Dim HTTPObj As WinHttpRequest
    Set HTTPObj = New WinHttpRequest
    Dim ResponseStr As String
        HTTPObj.Open "POST", ("http://testserver/PostUpdate.asp?XML=" & XMLstring), False   'Open HTTP Connection

        HTTPObj.Send    ' Send the request
        ResponseStr = HTTPObj.ResponseText   'the Response from server (text stream)

    Set HTTPObj = Nothing
End Function

A GREAT way to learn how to do all this and to see what is going on (esp. in understanding HTTP and the fact that web documents are
just text streams) is to replicate your request using TELNET.

    try this:

     try MANUALLY sending your request with TELNET to understand the process involved. Trust me, it will really help you.

 Having given you that,  note that I did not call winHTTP directly from an ASP page - I wrote a VB component that was a client
("made use of") winHTTP - I suppose you could call it directly...but why would you? you can already make HTTP requests with ASP/HTML
(links, form submissions, redirects, etc)

     winHTTP reference:

  Anyway, I know this was not your exact question (https), but maybe the code snippet will help.
   Good luck!

> Hi,
> Does anuyone have a code sample for using Microsoft's winHTTP component for sending HTTPS request 
> from an ASP page ?
> Any help is welcomed,
>       DD

  Return to Index