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 7: Responding to a request
 More of this Feature
• Pg 1: Intro to web-broker
• Pg 2: Using this tutorial
• Pg 3: Getting started
• Pg 4: Web Actions
• Pg 5: The first ISAPI app
• Pg 6: TWebRequestObject
• 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 can now retrieve information that the client send us via the web-browser, but how do we respond to the requests? From the examples in the previous chapters we have seen two ways to do this:

1. Setting the value of the Response.Content property.

2. Using the Response.SendRedirect method.

Note: In Delphi 5, the WebAction has a new property called the Producer. You can respond to a request by specifying a Producer in the property. However, I will not mention this anymore until we have seen the TPageProducer chapter.

SendRedirect
Have you ever been to a site that you knew was there yesturday, but today only a blank page appears with a small text saying:

This site has been moved. You will be re-directed to the new location in a few seconds........

This can actually be done in several ways. One way is to put a HTML meta-tag in the index page that does a re-direct. Some servers allow you to setup a site as a re-direction. For example in IIS you can create a new web-site that all it does is re-direct to another site.

Well, Response.SendRedirect can be viewed as something similar to the above. All it does is respond to the request by re-directing the client to a new URI. Take a look at the first example of this chapter (chapter7a.dpr). This has only one action which is also the default. It retrieves the value sent my the Query and re-directs you to the new location.

Response.SendRedirect(Request.QueryFields.Values['location']);

That's all you need to know to be able to use SendRedirect. In later examples I will make use of this feature alot.

Content
The Content property contains the information that is going to be sent back to the client. This information can be either an HTML string or an MIME compliant content type (images, files, etc). In the example Chapter7b, we take a look on how to send different contents depending on the request made. The first type is just an html string. The second type is a file. In the code there are three ifs.

Next page > TPageProducers > 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

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

Easy ways to connect two computers for networking purposes. More >

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

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

All rights reserved.