Solved

Internet Transfer Control on HTTPS usage. Authorization.

Posted on 2001-08-26
26
921 Views
Last Modified: 2007-11-27
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.
0
Comment
Question by:Crin
  • 9
  • 9
  • 4
  • +4
26 Comments
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6427089
You must define the UserName and Password properties prior to setting the URL property.

Anthony
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6427097
Ignore my previous comment, it is not correct.

Anthony
0
 
LVL 6

Expert Comment

by:JonFish85
ID: 6429762
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!
0
 
LVL 2

Author Comment

by:Crin
ID: 6429769
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
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6430304
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
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6430711
Learning...
0
 
LVL 75

Expert Comment

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

Anthony
0
 
LVL 2

Author Comment

by:Crin
ID: 6431395
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
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6432341
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
0
 
LVL 2

Author Comment

by:Crin
ID: 6433012
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,
0
 
LVL 2

Author Comment

by:Crin
ID: 6433029
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.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6433102
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.
0
 
LVL 2

Author Comment

by:Crin
ID: 6433271
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
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 2

Author Comment

by:Crin
ID: 6433575
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
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6433680
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
0
 
LVL 1

Expert Comment

by:eeevans
ID: 6434022
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
0
 
LVL 2

Author Comment

by:Crin
ID: 6435440
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
0
 
LVL 1

Expert Comment

by:eeevans
ID: 6436701
Have you tried setting the remote port to 443 for Https?
0
 
LVL 1

Expert Comment

by:eeevans
ID: 6436850
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6437010
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
0
 
LVL 2

Author Comment

by:Crin
ID: 6437414
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!
0
 
LVL 1

Expert Comment

by:eeevans
ID: 6437480
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
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6437486
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
0
 
LVL 27

Expert Comment

by:Asta Cu
ID: 6907006
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
0
 
LVL 2

Author Comment

by:Crin
ID: 6909848
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
0
 
LVL 1

Accepted Solution

by:
Moondancer earned 0 total points
ID: 6938274
Thanks, astaec, for letting me know that Crin needs assistance here.  I am sorry to see that you have not achieved your goal in this question.

I have refunded your 200 points to you and will move this to the PAQ at zero points to close it.  In the event this need still exists, you may benefit by posting it again to draw current attention.  Include the link to this one, perhaps it'll give some background and expedite the process.  Your choice, of course.

Moondancer - EE Moderator
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now