1. Technology
RTL reference|Glossary|Tips/Tricks|FREE App/VCL|Best'O'Net|Books|Link To
 
ISAPI tutorial for Delphi developers
Page 2: How to use this Tutorial
 More of this Feature
• Pg 1: Intro to web-broker
• Pg 3: Getting started
• Pg 4: Web Actions
• Pg 5: The first ISAPI app
• Pg 6: TWebRequestObject
• Pg 7: Request-responding
• Pg 8: TPageProducers
• Pg 9: Cookies made easy
• Pg 10: Stateless HTTP
• Pg 11: DB enabled apps
• Pg 12: FAQ
• Pg 13: DB apps - Part 1
• Pg 14: DB apps - Part 2
• Pg 15: DB apps - Part 3
 Join the Discussion
"Post your questions, concerns, views and comments to this article..."
Discuss!
 Related Resources
• Internet programming
• CGI and ISAPI with Delphi

Read it!

I think I should add a bit more than the previous statement to this chapter. To use this tutorial, you will have to have a web-server installed on your computer and also Delphi 4 Client/Server or the Professional version with the Webbroker add-on.Some chapters require Delphi 5 (Professional or Enterprise). I have tested these examples with PWS for Windows 98 and IIS for Windows NT Workstation and Server. My system is Windows Workstation and IIS 4.

By default IIS creates a directory called
C:\Inetpub\wwwroot
and another one called
C:\Inetpub\scripts

The first one contains all the documents that will be available on your webserver (html, gifs, jpegs, etc). The second one is where you can place the dll's you have created. You can replace these directories by any other ones. If you are using NT, make sure that you have assigned the correct permissions on each directory, both at NTFS level and in the IIS. In particular:

C:\Inetpub\wwwroot has to have at least read permissions for the IUSR_MACHINENAME user.

C:\Inetpub\scripts has to have execute permissions for the IUSR_MACHINENAME user.

IUSR_MACHINENAME what?
In NT, a request to the webserver is executed under a user. This user by default is IUSR_MACHINENAME, where MACHINENAME is the name of your computer.

What do I do with the source files?
Place the dll generated in the scripts directory and the html files in the wwwroot directory (unless otherwise stated). You then call the dll with the html files.

Debugging an ISAPI
As with any other application, the best way to learn and find out what is going on is to debug, and see hands-on what each line of code is doing. And as with any other application, you can also debug an ISAPI. However, depending on the webserver, there are different things you would have to do. Here are the basic steps for PWS on Windows 95/98 and IIS on Windows NT WS/Server.

PWS on Windows 95/98
1. Open your project.
2. Set the following the in the Run Parameters:

Run: \inetinfo.exe
Parameters: -e w3svc

3. Now, set your breakpoints and click on Run. Make sure that your dll is located in the scripts directory.

4. Call the dll from your browser.

IIS on Windows NT WS/Server
Debugging in IIS on NT is the same as in Windows 95/98 and PWS. However, there is one difference. In NT IIS runs as a service. To be able to debug, you will have to make some registry changes and some permission changes.

1. Run the User manager and change the rights for the user that is going to debug (the user that you log on to NT). Give this user the following permissions

Log on as a Service
Act as part of the operating system
Generate security audits

2. Next step, run the following registry file to make some changes. This will flick a few switches to allow the IIS to run as a process instead of a service. Remember, if you want to undo this, run the other registry file:

Run as a Process (to be able to debug run this one)
Run as a Service

If you have installd Option Pack 4 with SDK you should be able to find these files on your system.

3. Stop the WWW publishing service, FTP service and the IIS admin, and make the startup of all them manual.

4. Restart the computer.

5. Open your project.

6. Set the following the in the Run Parameters:

Run: \inetinfo.exe
Parameters: -e w3svc

7. Now, set your breakpoints and click on Run. Make sure that your dll is located in the scripts directory.

8. Call the dll from your browser.

Next page > Getting started > Page 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15

All graphics (if any) in this feature created by Zarko Gajic.

 More Delphi
· Learn another routine every day - RTL Quick Reference.
· Download free source code applications and components.
· Talk about Delphi Programming, real time.
· Link to the Delphi Programming site from your Web pages.
· Tutorials, articles, tech. tips by date: 2001|2000|1999|1998 or by TOPIC.
· NEXT ARTICLE: ADO Cursors - DB/10.
Chapter ten of the free Delphi Database Course for beginners. How ADO uses cursors as a storage and access mechanism, and what you should do to choose the best cursor for your Delphi ADO application.
 Stay informed with all new and interesting things about Delphi (for free).
Subscribe to the Newsletter
Name
Email

 Got some code to share? Got a question? Need some help?

©2014 About.com. All rights reserved.