How to open HTTP Authenticated URL in Delphi?

How to open a URL ( browser window ) that requires "http authentication", skipping login and password in a transparent way? The legacy application in delphi should open the report in ".aspx" from Reporting Services.

Thanks, Celso

+4
source share
3 answers

Use the Indy TidHTTP component as it easily handles authentication requirements. Drop the component in the form and:

IdHTTP1.Request.UserName := 'xxx'; IdHTTP1.Request.Password := 'xxx'; IdHTTP1.Get(x); 

I believe this works for any version of Indy you might have.

+5
source

You can use WinHTTP , check the IWinHttpRequest.SetCredentials method

check this sample

 uses Variants, SysUtils, WinHttp_TLB; Const HTTPREQUEST_SETCREDENTIALS_FOR_SERVER = 0; Var Http: IWinHttpRequest; begin try Http := CoWinHttpRequest.Create; try Http.Open('GET', 'http://Foo.com/home', False); Http.SetCredentials('AUser','APassword', HTTPREQUEST_SETCREDENTIALS_FOR_SERVER); Http.Send(EmptyParam); //Do your stuff finally Http:=nil; end; except on E:Exception do Writeln(E.Classname, ': ', E.Message); end; end. 
+4
source

you can only have a url with username and password, if acceptable.

http: // username: password@www.mysite.com /page.aspx

+1
source

All Articles