Link to home
Start Free TrialLog in
Avatar of Crin
Crin

asked on

Internet Transfer Control on HTTPS usage. Authorization.

Hello,

Have absolutely no time to understand internals of the problem achieved: what means MS Internet Transfer Control error "Client authorization not setup" and what should I do to prevent it?

Portions of the code:
Sub Start()
itcS1.URL = "https://a.b.c/d/"
itcS1.UserName = "crin"
itcS1.Password = "password"

itcS1.Execute

End Sub

On control's StateChanged event it reports state 11 - Error and incS1.ResponseInfo contain shown error.

Using http protocol everything works pretty well and on state 12 (response completed) returns correct data.

ALL data is valid, server is ok and everything works perfect using IE.

Sincerely,
Crin.
Avatar of Anthony Perkins
Anthony Perkins
Flag of United States of America image

You must define the UserName and Password properties prior to setting the URL property.

Anthony
Ignore my previous comment, it is not correct.

Anthony
Avatar of JonFish85
JonFish85

try this:

With itcS1
  .Username = "Username"
  .Password = "Password"
  .Protocol = icFTP '<< added this
  .URL = "127.0.0.1"
  .Execute
End With

just an idea, but i hope it helps!
Avatar of Crin

ASKER

Hello.

Need at least explanations on what "Client authorization not setup" error means...

Any combination of correct data with MS Internet Transfer Control gave the same result with shown error...

May be it will help: even if I specify unexisted server - error is still the same...

Any ideas on what another control to use?
I need to be able to connect to some server using HTTPS (with username and password), post some special data and receive the response.

Any suggestions?

Sincerely,
Crin
If all you want to do is POST data to a server, you may want to check out the XMLHTTP object.  Just make sure you are using at least version 3.0 (it should be dated no later than November 2000) as there were problems with connecting to https in previous versions.

Anthony
Learning...
Of course, I meant to say: "no earlier than November 2000", but I think it was self evident.

Anthony
Avatar of Crin

ASKER

Hello.

Some comments.
JonFish85,:
When Protocol property is specified, the URL property is updated to show the new value. Also, if the protocol portion of the URL is updated, the Protocol property is updated to reflect the new value. The OpenURL and Execute methods may both modify the value of this property.

Anthony rejected answer regarding properties order, however for further visitors - this portion of MS documentation: "Note   When using the OpenURL method, set the URL property before you set the Password and UserName properties. If you set the URL property last, the UserName and Password properties will be set to ""."

Anthony - regarding XMLHTTP control - if you mean MS XMLHTTP control - could you send some examples on how to use it with Visual Basic, not ASP as in MS documentation.

Sincerely,
Crin
I used something similar to the following to POST data to a URL and receive back an XML document.  (Obviously this last is optional).

Make a reference to Microsoft XML version 3.0 and add this data, making the necessary changes.

Sub PostData()
Dim xmlReq As MSXML2.ServerXMLHTTP
Dim xmlDoc As MSXML2.DOMDocument

On Error GoTo ErrHandler

Set xmlReq = New MSXML2.ServerXMLHTTP
With xmlReq
   .open "POST", "insert URL here", False, "username", "password"
   .setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
   .send "insert data to be posted here" ' something like "var1=value1&var2=value2"
   Set xmlDoc = xmlReq.responseXML
End With
Debug.Print xmlDoc.xml

Set xmlDoc = Nothing
Set xmlReq = Nothing

Exit Sub
ErrHandler:
If xmlDoc Is Nothing Then
   Debug.Print Err.Description
Else
   Debug.Print xmlDoc.parseError.reason
End If

End Sub
Avatar of Crin

ASKER

Anthony,

Unfortunatelly, I need a little bit more sophisticated solution. At least I need xmlhttp to be asynchronous since data would be huge and I don't want software to be stalled.

In this case I should specify onreadystatechange property. How? Documentation contain modest explanation:
oXMLHttpRequest.onreadystatechange = funcMyHandler

Also, could you briefly explain the difference between XMLHTTP and ServerXMLHTTP objects (if you have enough time to type it :)? I know that this issue should be covered by documentation, but simple search gave me no results...

Sincerely,
Avatar of Crin

ASKER

Oops.

Unfortunatelly: "Note that onreadystatechange is designed for use in scripting environments and is not readily accessible in Microsoft? Visual Basic? or C++." From MSDN.

So, of course it is workaround to place timer on the form and check the state of the object...

But..  Are there any other possibilities? We can negotiate points issue :))

Sincerely,
Crin.
Yes, you discovered a basic flaw with the implementation of the OnReadyStateChange using Visual Basic.  I have never used anything other than synchronous.  So I cannot help you more on this issue.

As regards XMLHTTP and ServerXMLHTTP.  The difference is that the latter does not rely on WinInet and so is "server safe"  In other words you can use it from one server to another.  If this is not the case than XMLHTTP should work, they are code compatible.

In addition SererXMLHTTP requires Windows NT and IE5.01 (or later)

Hope this helps.
Avatar of Crin

ASKER

Ok.

The problem is not resolved yet.

What "Client authorization not setup" error means, did one use this control or Microsoft developed it for their own interest? :))

Sincerely,
Crin
Avatar of Crin

ASKER

Hmmmmm...  Seems so strange...
The code is working for now...
Right initial code and without error...

Ok. Just tested and error still exists on some (another) servers.

Anthony - you are almost the only person tried to help. Do you think I should grant points to you with grade D (since your offer is just a workaround) or delete question (since problem disappeared and I solved it myself)?
Finally - points will be *surely* granted for the link explaining control's errors - some of them are strange...

Sincerely,
Crin
As far as I am concerned you can delete the question.  I am sorry I could not help more.

By the way, the Win32 Internet Error Message constant for this error message is ERROR_INTERNET_CLIENT_AUTH_NOT_SETUP and has a value of 12044.

Anthony
Crin,

Did you change anything on the machine that it has started working on like changing from 56 to 128 bit security or anything?

Regards,
eeevans
Avatar of Crin

ASKER

Anthony,
thank you for your help. I will not delete question yet.

eeevans,
No. Nothing changed. but....

Discovered: yesterday's success were produced by testing with IE: after I opened url in IE I can open it with control also... So, how IE 'kicks' the site and how can I perform it from control? I afraid I really need this error explanation, however altavista and other search engines (including MSDN!!!) gave me 0 (zero) documents...

Sincerely,
Crin
Have you tried setting the remote port to 443 for Https?
I think eeevans is on the right track (and deserves the points), especially the second link.

You can also find you are not alone <smile>, if you look up this error on www.deja.com  This pointed me at another link namely:
http://www.codeguru.com/internet/client_cert.shtml

Which made reference to a KB article on MSDN:
http://support.microsoft.com/support/kb/articles/q224/2/82.asp
which pointed me to (you know how that goes) the following link:
http://support.microsoft.com/support/kb/articles/Q182/8/88.ASP
and eventually this one:
http://support.microsoft.com/support/kb/articles/Q168/1/51.ASP

I am sure you have seen all of these articles on MSDN, but just in case.

If you still find you are hitting your head against the wall, let me suggest you try out Mabry's HTTP/X control.  It does cost $150, but you can download it first and see if it works for you.

Anthony
Avatar of Crin

ASKER

Hmmm...

I carefully checked links provided by eeevans, it's a pity, they didn't help - error still exists...
Also - yes, I defenitely use port 443. Thanks for the help! I promise your efforts will be covered with points :) And sorry this is not the end yet :)

I beleive my testing server require certificate, however, in first article Antony gave autor refer to ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED error which is different with error I'm having...
*May be* IE send this info to server, server keep certificate and when I'm treying to reconnect shortly using my software it can recognize me?

Since I have instance of control - I can not use API referred at MSDN... Or I (you) should prepare own control with almost same functionality with MS Internet Transfer control and realized as VB class using API.

Finalizing (as I understood the problem), we are having problems with certificates over HTTPS connection using MS Internet Transfer control. Are there any way to prevent error? Which way is simplest and easiest?

Sincerely,
Crin

PS. As I previously mentioned, this topic is VERY important for me, so points are not a problem at all. Anybody - welcome to solve the problem!
I am of the opinion that you may not be able to get to all https servers with the ITC depending on the type of authorization that the server is setup to use.  Do you know what kind the server you are hitting is using?  With all the mention of Base64 encoding and the like, I'm a little out of my league here as I've never worked with https and from a lot of what I've found on the web it's out of a lot of people's league.  I'm guessing that one may need to do some actual WinInet programming here to get it to work with some https servers depending on the OS the server is on and the auth type.  I hope someone can help.

Regards
First of all I think I may have made a mistake the error number for ERROR_INTERNET_CLIENT_AUTH_NOT_SETUP should be INTERNET_ERROR_BASE + 46 = 12046 (not 12044)

I would not go down the API road using VB as although you have much more control you will still be stuck to writing a sychronous control.  I know, because I have written one.

I would strongly urge you to take a look at the Mabry HTTP/X control.  You should be able to download and test fairly quickly.  THen you can decide if it is worth the money.

Yes, I do believe it is a problem with certificates.

Anthony
Please update the expert here who have so willingly stepped in to help you, since much time has passed since your last comments, and Email notifications may not have been generated to the participating experts here due to some problems at that time.  If you've been helped, accept the respective question by that expert to grade and close it.

Somewhat off-topic, but important.

****************************** ALERT********************************
WindowsUpdate - Critical Update alert March 28, 2002 from Microsoft
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/security/bulletin/ms02-015.asp
Synopsis:
Microsoft Security Bulletin MS02-015  
28 March 2002 Cumulative Patch for Internet Explorer
Originally posted: March 28, 2002
Summary
Who should read this bulletin: Customers using Microsoft® Internet Explorer
Impact of vulnerability: Two vulnerabilities, the most serious of which would allow script to run in the Local Computer Zone.
Maximum Severity Rating: Critical
Recommendation: Consumers using the affected version of IE should install the patch immediately.
Affected Software:
Microsoft Internet Explorer 5.01
Microsoft Internet Explorer 5.5
Microsoft Internet Explorer 6.0

Thought you'd appreciate knowing this.
":0)
Asta
Avatar of Crin

ASKER

Hello, I do remember about both my still unlocked questions. However, they still have no answers. Actually, I would like to grant even more points to experts who tried to help, but I don't want to create bad PAQ - one who will pay question points to look at here will be disappointed, or I should give low grade.

Unfortunatelly, problem was not solved. We used HTTP instead of HTTPS in the project since information is not so much critical for the customer.

Sincerely,
Crin
ASKER CERTIFIED SOLUTION
Avatar of Moondancer
Moondancer

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial