1. Home
  2. Computing & Technology
  3. Delphi Programming
RTL reference|Glossary|Tips/Tricks|FREE App/VCL|Best'O'Net|Books|Link To
 
ISAPI tutorial for Delphi developers
Page 5: The first ISAPI application
 More of this Feature
• Pg 1: Intro to web-broker
• Pg 2: Using this tutorial
• Pg 3: Getting started
• Pg 4: Web Actions
• 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

We are going to start off our tutorial with a very simple example of an ISAPI extension. This example is going to put to use what we saw in the previous chapter regarding web actions. This chapter is also intented to show you how to make use of the extension you have created. Please note, that as for all the examples of this tutorial I am assuming that you have a web-server installed on your computer (being it PWS, IIS, Apache or any other one).

From now on, I assume that the basic steps for creating a web server application are already known. If you still don't know how to start one, refer back to Pg 3: Getting started.

You should already have a new webmodule on the screen waiting for you to start dropping components on. Sorry to say, in this first example there will be * no component dropping *.

We are going to make only one action. Double click on the WebActionItems in the Object Inspector and create a new action. Name it waDEFAULT. Set the Default property to True and the PathInfo to /default

Now that we have the new action, double-click on the OnAction event and Delphi will insert the code for you. Once that is done, we are going to add the following code:

procedure TwmCHAPTER5.wmCHAPTER5waDEFAULTAction
(Sender: TObject; Request: TWebRequest;
Response: TWebResponse; var Handled: Boolean); 
begin
Response.SendRedirect (Request.Referer); 
end;

All this web action does is re-direct the request to the original URL from where it was made, i.e. to the call. SendRedirect redirects to a URL that is passed as a parameter. It is a method of TWebResponse. Response is basically the response to the HTTP request. You can respond in a wide variety of ways, either by a re-direction (as in this case), responding by setting the Content property and so on. I will focus on the TWebRequest and TWebResponse objects in later chapters.

Next page > A close look at the TWebRequest object > 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?
Explore Delphi Programming
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming

©2009 About.com, a part of The New York Times Company.

All rights reserved.