Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Delphi 2 on CGI Bin - Win NT 4.0 IIS

Posted on 1997-06-01
2
Medium Priority
?
389 Views
Last Modified: 2010-04-06
Is there anyway I can create CGI program which run on
NT 4.0 server uses microsoft IIS only without any
additional delphi component and without additional Win CGI interface like O'reilyes ??
I'm using Delphi 2
0
Comment
Question by:anakecil
2 Comments
 
LVL 1

Accepted Solution

by:
ygolan earned 200 total points
ID: 1336735
anakecil,

I will assume that you know the basic theory behind CGI - the server receiving a REQUEST, invoking the CGI program with the request, the CGI program producing a RESPONSE to the standard output stream, etc.

Once you understand this basic model, writing plain CGI program is easy. Here is a minimal CGI "Hello World" CGI application :

program Project1;

begin
    Writeln('HTTP/1.0 200 OK');
    Writeln('Content-Type: text/html');
    Writeln('');
    Writeln('Hello World');
end.

Put this code in a project file (project1.dpr), compile it, and place project1.exe in the InetPub\Scripts directory (or any other directory which has the Execute attribute defined for it in IIS).

Invoke it with "http://127.0.0.1/scripts/project1.exe"

The next step depends on what you need the CGI program to do. However, most CGI programs need to acess the "Query String" - this is the part the follows the question mark in the URL, and which is usually generated when you click the "Submit" button in a HTML form. Here is an example of a URL with a Query String :

http://127.0.0.1/scripts/project1.exe?Name=Joe&Age=21

This Query String contains 2 fields, Name and Age. To access the Query String, retrieve the value of the QUERY_STRING environment variable :

SetLength(QS, 1024);
SetLength(QS, GetEnvironmentVariable('QUERY_STRING', PChar(QS), 1024));

This is about all you need to get started -

Yaniv
0
 

Author Comment

by:anakecil
ID: 1336736
I already bought several books about Delphi CGI programming, but I really don't know why on those books, they can't answer what I really want to know about CGI, they event told me about the INI files and etc. but all their program won't run. But here your answer is excellent !!! you deserve a high five since your answer very clean and crisp, direct to what I really want to know. Thxx for your answer YGOLAN !!! You and Expert Exchange is really the best place I ever found to find an answer !!!! I can now start to write my own CGI programming thxx a lot !!! keep a good answer like this, You should be the best Delphi programmer around, I really appreciate your answer, since I already found the right path.Byeee for now c ya soon- AnaKecil -
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question