Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15237

WinHttpRequest - errors like 'method cannot be called until open/send has been called

$
0
0
Hi,

After both Opening and Sending a request, some of the propertes of a WinHttpRequest are displaying errors.


Code:

On Error Resume Next

    Set objHTTP = CreateObject( "WinHttp.WinHttpRequest.5.1" )
    Request_s = "GET"
    
    objHTTP.Open Request_s, Url_s, False
    objHTTP.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
    objHTTP.SetCredentials User_s, Password_s, HTTPREQUEST_SETCREDENTIALS_FOR_SERVER
    objHTTP.Send Credentials_s
  '// BELOW, Status (and ResponseBody and ResponseText, etc.) are showing that the request hasn't been sent, even though it just was.
  '// ALSO, the Option property says that the Open method must be called.
    Status_n = objHTTP.Status
    Status_Text_s = objHTTP.StatusText
    HTML_s = objHTTP.ResponseText


Viewing all articles
Browse latest Browse all 15237

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>