Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.




ID: 30314, XE8 HTTP Basic Access Authentication

by Al Mannarino Email: Anonymous


Example shows using the new RAD Studio XE8 native HTTP Client Libraries for HTTP Basic Authentication.
Download Details
FTP  download also available
CDN Login Required to Download. (You will be redirected to the login page if you click on the Download Link)
To download this, you must have registered:
A free membership

For Delphi, Version 16.0  to 16.0 492 downloads
Copyright: All rights reserved


Terms of use: Embarcadero use at your own risk disclaimer


Size: 9,612 bytes
Updated on Fri, 24 Jul 2015 17:21:19 GMT
Originally uploaded on Fri, 24 Jul 2015 17:21:10 GMT
SHA1 Hash: A22A3341126C96DAD3B8917D8D4FD4DBD6C6F8BE
MD5 Hash: D367C341F8D77AF6BF49F194AEABEDCB

    Explore the files in this upload

Description
Example shows using the new RAD Studio XE8 native HTTP Client Libraries for HTTP Basic Authentication.

HTTP Basic Auth (or Basic access authentication) is a widely used protocol for simple username/password authentication, for example, when your web browsers prompts you for credentials.

Using the new RAD Studio XE8 native HTTP CLient Libraries, when you send an HTTP request to a server that requires HTTP basic access authentication, the OnAuthEvent of your HTTP client object occurs.
To submit your access credentials, you provide an event handler for this event and, if the value of the second parameter that the event handler receives (AnAuthTarget) is TAuthTargetType.Server, then you fill the AUserName and APassword variables with your username and password for HTTP access.

The example uses an IIS Server with HTTP Basic Authentication Enabled.
A DataSnap REST Server as an ISAPI DLL is deployed on the IIS.

If your access credentials are incorrect, the server returns a StatusCode= 401 and its StatusText=Unauthorized.
And your LResponse.ContentAsString output gives a message like this:
"This error occurs when either the username or password supplied to IIS is invalid, or when IIS cannot use the username and password to authenticate the user."

If your access credentials are correct, the server returns information on the DataSnap REST Server.

   Latest Comments  View All Add New

Move mouse over comment to see the full text

Server Response from: ETNACDC03