-
Sep 20th, 2014, 12:44 PM
#1
Thread Starter
New Member
VB6 WinHttp not working
Code:
Dim HTTP
Set HTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
HTTP.setTimeouts 50000, 50000, 50000, 50000
HTTP.Open "POST", sAddress, True
HTTP.setRequestHeader "Content-Type", "multipart/form-data; boundary=" & ""
'On Local Error Resume Next
HTTP.send Data
resp = HTTP.responseText
We have an old VB6 Project that we are updating.
After a client asked for changes, the above code stopped working
On the HTTP.send, we get "the data necessary to complete this operation is not yet available"
Been searching Google but can not find a good solution.
-
Sep 20th, 2014, 12:46 PM
#2
Re: VB6 WinHttp not working
This isn't the correct part of the forum for posting questions. It is used for posting sample code/projects that can be used as-is.
I've notified the moderators so that they can move this to the proper forum section for you
-
Sep 20th, 2014, 05:00 PM
#3
Re: VB6 WinHttp not working
Originally Posted by XardozCom
Code:
Dim HTTP
Set HTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
HTTP.setTimeouts 50000, 50000, 50000, 50000
HTTP.Open "POST", sAddress, True
HTTP.setRequestHeader "Content-Type", "multipart/form-data; boundary=" & ""
'On Local Error Resume Next
HTTP.send Data
resp = HTTP.responseText
We have an old VB6 Project that we are updating.
After a client asked for changes, the above code stopped working
On the HTTP.send, we get " the data necessary to complete this operation is not yet available"
Been searching Google but can not find a good solution.
The first mistake I see, is that you are using the HTTP-Object in async-mode (last Param in the Open-method).
So don't expect to get anything useful returned in your last line:
resp = HTTP.responseText
shortly after sending the request (asynchronously).
Though since you apparently get the error already when you call the Send-method,
I'd suspect that what you've passed in your Data-Variable was not valid multipart/form-data
content - or (more likely) 'Data' even being "completely emtpy yet".
Olaf
-
Sep 20th, 2014, 05:02 PM
#4
Thread Starter
New Member
Re: VB6 WinHttp not working
Sorry for the mis-post.
Thank you Olaf, I found the solution as you posted
Issue solved.
Below causes the issue, ASYNC=True
Code:
HTTP.Open "POST", sAddress, True
This works! ASYNC=False
Code:
HTTP.Open "POST", sAddress, False
Last edited by XardozCom; Sep 20th, 2014 at 05:05 PM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|