Solved

Delphi 2 on CGI Bin - Win NT 4.0 IIS

Posted on 1997-06-01
2
380 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Accepted Solution

by:
ygolan earned 50 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

752 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