Watch, Follow, &
Connect with Us

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


ID: 16138, Password protect ISAPI/CGI actions with basic authentication

by Pablo Reyes Email: Anonymous


Supose you have an ISAPI application with 3 actions and you want to password protect only one of them.
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 5.0  to 5.0 884 downloads
Copyright: No significant restrictions


Size: 6,608 bytes
Updated on Sat, 12 May 2001 07:15:02 GMT
Originally uploaded on Sat, 12 May 2001 07:14:31 GMT
SHA1 Hash: 7D562E4AE6C8F4BAB7606A81A697691BC08948A6
MD5 Hash: 37181E958225CA264B2BAB31EA95DD8D

    Explore the files in this upload

Description
It is very easy to protect a web server virtual directory with basic authentication.
Supose you have an ISAPI application with 3 actions and you want to password protect only one of them. This example shows you how you could do that with only one ISAPI application.


Source Code:
============

- This 2 lines tells browser to prompt for user name and password:

Response.StatusCode := 401; // Promp for user name and password
Response.WWWAuthenticate := 'Basic realm="Delphi"'; // Title

- Browser sends user name and password and we can get it:

Request.Authorization

- But information is encoded with Base64. There a lot of free source code that implements Base64 encode/decode. The following line returns
decoded data in mAuthorization.

FBase64.DecodeData(Copy(Request.Authorization, 6,
Length(Request.Authorization)), mAuthorization);


Have fun!

   Latest Comments  View All Add New

Move mouse over comment to see the full text

Could not retrieve comments. Please try again later.

Server Response from: ETNACDC03