Solved

Delphi 2 on CGI Bin - Win NT 4.0 IIS

Posted on 1997-06-01
2
383 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses
Course of the Month4 days, 5 hours left to enroll

630 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