sviksna
asked on
the CGI for IIS (PWS) servers
Hello, Experts.
I have problems with making CGI. So, I have D4 with internet components. So, I am loking for information about building CGI applications. All kind.. from counters till shoping things.
Thank you for your help.
Sandis Viksna.
I have problems with making CGI. So, I have D4 with internet components. So, I am loking for information about building CGI applications. All kind.. from counters till shoping things.
Thank you for your help.
Sandis Viksna.
remember to enable CGI on the website in IIS (well it caught me out for a while)
ASKER
ckaneta,
it would be nice. thank you.
Sandis.
it would be nice. thank you.
Sandis.
okay, either write to me at ckan1010@aol.com and I'll send it in a reply or get it from here
members.xoom.com/kaneta/dw nld/cgistu ff.zip
~ or ~
members.xoom.com/kaneta
and go to the 'stuff' page
members.xoom.com/kaneta/dw
~ or ~
members.xoom.com/kaneta
and go to the 'stuff' page
ASKER
the code
program response;
{$apptype console}
uses Sysutils;
begin
writeln('HTTP/1.0 200 OK');
writeln('CONTENT-TYPE: TEXT/HTML');
writeln('<html><head>');
writeln('<title>blah blah</title>');
writeln('</head><body> here it is dude');
writeln('</body></html>');
end.
----------------------
the result
-----------------------
CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:
HTTP/1.0 200 OK
CONTENT-TYPE: TEXT/HTML
here it is dude
-------------------------
can u help me?
The second writeln is not right. Change or remove it and try again.
Hi,
Select 'File-New-Web Server Application' from Delphi main menu and then 'CGI Stand-alone Executable'. This way you have created new CGI project with WebModule. In WebModule you can add Action Items for different HTTP methods like GET and POST and for different 'commands' after the name of your CGI script, defined in the calling HTML page like
....
<FORM METHOD=POST ACTION="/scripts/MyScript. exe/login" >
.....
where 'MyScript.exe' is the name of the script and '/login' is the 'command', corresponding with Action Item with PathInfo property = /login.
There are Request object containing all information about the client's browser request and Response object which Content property your program has to fill with HTML page and send back using SendResponse method.
You have to build the exe and copy to the scripts directory of the Web server.
It's not so hard stuff as it sounds.
Regards, Geo
Select 'File-New-Web Server Application' from Delphi main menu and then 'CGI Stand-alone Executable'. This way you have created new CGI project with WebModule. In WebModule you can add Action Items for different HTTP methods like GET and POST and for different 'commands' after the name of your CGI script, defined in the calling HTML page like
....
<FORM METHOD=POST ACTION="/scripts/MyScript.
.....
where 'MyScript.exe' is the name of the script and '/login' is the 'command', corresponding with Action Item with PathInfo property = /login.
There are Request object containing all information about the client's browser request and Response object which Content property your program has to fill with HTML page and send back using SendResponse method.
You have to build the exe and copy to the scripts directory of the Web server.
It's not so hard stuff as it sounds.
Regards, Geo
ASKER
The advice one step up is ok. But how to do with thing like session() in ASP. How i can pass the data in novisual mode, i meant with this, that data isn't visible into the location bar, like
some.exe?name=john®num= 32434234
couse, these params are constants for current user in all pages, but i don't wana write them in the HTML code as Hiden object (<input type="hiden"..) security for...
so, is there any solution for this?
Sandis.
some.exe?name=john®num=
couse, these params are constants for current user in all pages, but i don't wana write them in the HTML code as Hiden object (<input type="hiden"..) security for...
so, is there any solution for this?
Sandis.
Use cookies. This is how asp sessions work...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
hi, geo, again
{ reading values from somewhere - from Request here }
login:=Request.ContentFiel ds.Values[ 'login'];
passw:=Request.ContentFiel ds.Values[ 'passw'];
is that like value
cgi-bin/myapp.exe/login=lo giname&pas sw=somepas s
am i right?
{ reading values from somewhere - from Request here }
login:=Request.ContentFiel
passw:=Request.ContentFiel
is that like value
cgi-bin/myapp.exe/login=lo
am i right?
Hi,
I'm using POST method in my example and login and pass values are in the content property of the request (INPUT text/password html tags and a button).
You are using GET method in your example and the info is in the query property of the request. So the code will be:
login:=Request.QueryFields .Values['l ogin'];
passw:=Request.QueryFields .Values['p assw'];
Regards, Geo
I'm using POST method in my example and login and pass values are in the content property of the request (INPUT text/password html tags and a button).
You are using GET method in your example and the info is in the query property of the request. So the code will be:
login:=Request.QueryFields
passw:=Request.QueryFields
Regards, Geo
ASKER
This was one of moust useable anwers.
Thank You.
Thank You.
program cgi;
{$apptype console}
uses Sysutils;
begin
writeln('HTTP/1.0 200 OK');
writeln('CONTENT-TYPE: TEXT/HTML');
writeln('<html><head>');
writeln('<title>blah blah</title>');
writeln('</head><body>');
writeln('</body></html>');
end.
basically from Cantu's book.
I can try to dig up a sample and send it if you like