Solved

HTTP Authorization/Authentication

Posted on 1998-09-29
11
204 Views
Last Modified: 2010-04-06
I have Delphi 3.0 and I need to download html documents from a secure server with my application.

Is this possible with Delphi 4.0?
Is there a freeware component for Delphi 3.0 that can do it?
Is it possible to solve it by using the HTTP Client ActiveX Control instead of the HTML ActiveX Control in Delphi 3.0?

Any help is greatly appreciated.
0
Comment
Question by:friberg
  • 4
  • 3
  • 2
  • +2
11 Comments
 
LVL 4

Expert Comment

by:BoRiS
ID: 1341099
friberg

yes this can be done with delphi 4.0 as well...

a freeware component for this kind of stuff can be found at ...

http://www.rtfm.be/fpiette/indexuk.htm

I think both activex controls can handle this but the HTTP is the way to go...

All I can really tell you is that the request is in the document headers for the authorization....

I think the best to do is search on www.yahoo.com for http headers and follow the nic links...

I will see what I can get hold of code wise and let you know...

Later
BoRiS
0
 
LVL 1

Expert Comment

by:duke_n
ID: 1341100
Pardon me if I'm wrong, but
you just call Executefile on internet adress to open it or download it.
if it's secure there is a certain format of URL adress, e.g.:
to enter experts-exchange I write:
'http://duke_n:mypassword@experts-exchange.com/topics/comp/lang/delphi/'

Regards,
Nukem

btw: When will the new 'Duke Nukem Forever' come to the stores?
0
 

Author Comment

by:friberg
ID: 1341101
Thanks, the ICS component solved a part of my problem. For example, when you try to get the page
http://www.experts-exchange.com/Q.10084603
you are presented with a Netscape or IE 'enter user name and password'-dialog. The ICS component can enter this programatically, which is one feature that I need.

However, when the user has to enter user name and password in an edit box directly on the web page, for example at:
http://rtq.thomsoninvest.net/index.sht  or at:
https://wwws.ameritrade.com/cgi-bin/login.cgi
the problem remains. I couldn't find a way to do this with ICS.

Does anyone have an idea how to solve this?

Thanks in advance!
0
 
LVL 4

Expert Comment

by:BoRiS
ID: 1341102
friberg

as far as I know you can do this with the html component the samre way as the http component handles it

eg

Document.Request('Authorization');
  Result := Document.Authorization;

this is just an example you will need to check the options on the html component for
document.

Later
BoRiS
0
 

Author Comment

by:friberg
ID: 1341103
Sorry, but I don't understand what you mean.
For example, let's say I want to log in on:
https://wwws.ameritrade.com/cgi-bin/login.cgi
with Account Number: 12345 and Pin: 678, how would I do?

Thanks!
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 4

Expert Comment

by:BoRiS
ID: 1341104
friberg

Sorry second answer was surposed to be a comment....

if you know the username and password then pass the href like so...

http://12345:678@wwws.ameritrade.com/cgi-bin/login.cgi

this should send the username and password at the same time as the url to the http...

Later
BoRiS
0
 
LVL 4

Expert Comment

by:itamar
ID: 1341105
Hi friberg,

in the URL you mentioned, 12345 and 678 are not Http authorization. In fact they are simple parameters to a CGI. In HTML they are <INPUT TYPE...>

If you have downloaded ICS tools, you can take a look at one of the examples of Http.
I don´t remember the name right now, but it´s not difficult to find.

IHTH,
Itamar
0
 

Expert Comment

by:manolis_afentakis
ID: 1341106

there is a native vcl component (internet mail suite)

but it's commercial...

seehttp://www.argosoft.com


0
 

Author Comment

by:friberg
ID: 1341107
manolis_afentakis,

Yes, and I know about another commercial component as well, but I'm looking for a freeware component (and have actually found one)

Thanks.
0
 
LVL 4

Accepted Solution

by:
itamar earned 200 total points
ID: 1341108
Hi friberg,

the name of the example is HTTPASP.

In the OnClick event handler of Button1 you must change this part of code:
    ...
    try
        Buf     := 'suplno=' + Trim(SupplierIDEdit.Text) +
                   '&PIN=' + Trim(PinEdit.Text) +
                   '&LOGIN=Login';
        DataOut.Write(Buf[1], Length(Buf));
    ...

Change the PIN and LOGIN for the <INPUT TYPE...> of the form you want to submit.
But it seems to me that, in the URL you mentioned there is some kind of trick to avoid programatic acces. There are two hidden fields, log_sess and dv_data that gave me the clue. It doesn´t make my answer wrong, but i think it will be a pain for you ;(

IHTH,
Itamar


0
 

Author Comment

by:friberg
ID: 1341109
You are right, they seem to have tried to avoid programmatic access. I will have to work on it - but I think I'm on the right track at least. Thanks!

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi IDE crash without error message ... 7 76
delphi parse string to params 3 97
Delphi inherited method 6 62
how can i search if string exist in array ? 3 49
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

912 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

20 Experts available now in Live!

Get 1:1 Help Now