A problem about ISAPI

I am a beginner of Delphi5.0, Now I am learning to write a ISAPI program, here is a problem about "POST" and "GET" method
I created a Web Server Application base on ISAPI, here is the code:

procedure TWebModule1.WebModuleWebActionItem1Action(Sender:TObject; Request:TWebRequest;
  Response:TWebResponse;Var Handled:Boolean);
Var
   Input:TString;
   areaname:String;
Begin
   Input:=Nil;
   Case request.methodtype of
       mtpost: Input:=request.ContentFields;
       mtget,mtput,mthead: Input:=request.QueryFields;
   end;
   areaname:=Input.Values['area']
   ......
   ......
End.

Now, the problem is:
I use "GET" method in Html I can get the value of 'area', if I use "POST" method in Html I can get Nothing, why? Please help me

here is the Html code:

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body bgcolor="#FFFFFF">
<form method="POST" action="/scripts/webquery.dll">
input:  <INPUT NAME="Area" VALUE="" SIZE=60>
  <p>
    <input type="submit" value="Submit">
    <input type="Reset" value="reset">
  </p>
</form>
</body>
</html>

OS: Win98, omnihttp web server
lxwizardAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

intheCommented:
Hi
do you want
Request.ContentFields.Values['area']

and the forms method = get
should be methoiod=Post shouldnt it.

0
rwilson032697Commented:
Listening
0
intheCommented:
btw:
i think you will like this website :

http://www.209software.com/books/wpid/
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

lxwizardAuthor Commented:
Edited text of question.
0
lxwizardAuthor Commented:
Thank you all, but I can not get a approving solution, who can help me.
if you can try it on your computer.
OS:Win98 + Omnihttp http server.
"GET" Method is OK
"POST Method do nothing????
0
geobulCommented:
Hi,

1.Check that WebActionItem1.MethodType is mtAny.

2. Input : TStringS;

Regards, Geo
0
geobulCommented:
My previous comment was not clear. Sorry!

Here it is:

Your WebActionItem1.MethodType have to be mtAny. Your program has to check Method property (string) is it equal to:
'GET'
'POST' etc.
instead of MethodType.

MethodType property is a mask of accepted methotds. Method property is the actual method in the request.

Regards, Geo
0
RadlerCommented:
Hi lxwizard,

I passed by a similar trouble with a friend ( I dont have D5)
If you change the method after a uniqueness ISAPI DLL load you need restart the MTS to all back to work, I discovered this while debbuging a old code.
If you is debugging at this manner try make this.

T++, Radler.
0
intheCommented:
HI,
ive tested this :

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, HTTPApp;

type
  TWebModule1 = class(TWebModule)
    procedure WebModule1WebActionItem1Action(Sender: TObject;
      Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  WebModule1: TWebModule1;

implementation

{$R *.DFM}

procedure TWebModule1.WebModule1WebActionItem1Action(Sender: TObject;
  Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);

Var
   Input:tStrings;
   POSTareaname,GETareaname:String;
   Page:TStringList;
   Begin
 Input:=Nil;
   Case request.methodtype of
       mtpost: Input:=request.ContentFields;
       mtget,mtput,mthead: Input:=request.QueryFields;
   end;
   GETareaname:=Input.Values['areaget'];
   POSTareaname:=Input.Values['areapost'];
 Page := TStringList.Create;
try
  with Page do
 begin
Add('<HTML><BODY>Your request contains the following information:<BR><BR>');
Add('<BR>Your IP address is: ' + Request.RemoteAddr );
Add('<BR>Your POSTareaname is: ' + POSTareaname );
Add('<BR>Your GETareaname is: ' + GETareaname );
Add('<BR>You are using the following browser and operating system: ' + Request.UserAgent);
Add('<BR>You asked for the following URL: http://' + Request.Host + Request.URL + Request.PathInfo );
Add('</BODY></HTML>');
 end ;
   Response.Content := Page.Text ;
  finally
    Page.Free;
  end ;
    Handled := True ;
end;

end.




html file:

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body bgcolor="#FF00EE">

<form method="post" action="/scripts/webquery.dll">
input using post :  <INPUT NAME="Areapost" VALUE="" SIZE=60>
  <p>
    <input type="submit" value="Submit">
    <input type="Reset" value="reset">
  </p>
</form>

<form method="get" action="/scripts/webquery.dll">
input using get:  <INPUT NAME="Areaget" VALUE="" SIZE=60>
  <p>
    <input type="submit" value="Submit">
    <input type="Reset" value="reset">
  </p>
</form>
</body>
</html>

the response will send back the inputtext now depending on which input box you submit
 
Regards Barry
0
lxwizardAuthor Commented:
Hi, dear My friends.
I have tried the program above. I type ¡°Hello World¡± into both of  textboxs in web page. But the problem is still here. Here is the result:

Use ¡°post¡± method:

Your request contains the following information:


Your IP address is: 127.0.0.1
Your POSTareaname is:
Your GETareaname is:
You are using the following browser and operating system: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)
You asked for the following URL: http://

Use ¡°get¡± method:

Your request contains the following information:


Your IP address is: 127.0.0.1
Your POSTareaname is:
Your GETareaname is: Hello World!
You are using the following browser and operating system: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)
You asked for the following URL: http://

¡°POST¡± method do nothing!

Maybe my softwares environment has some problem?

Win98 Second Edition (Simple Chinese)+Omnihttp HTTP Server+Delphi5.0+IE5.0
0
lxwizardAuthor Commented:
Nobody can make a solution.
The problem is still here.
0
lxwizardAuthor Commented:
Nobody can make a solution.
The problem is still here.
0
intheCommented:
my answer is correct.

you can only get one method at a time.
in my example if you type in the POST box and press submit you get back:
Your POSTareaname is:Hello World!  
Your GETareaname is:

but if you type in the GET box and press submit you get back:

Your POSTareaname is:
Your GETareaname is: Hello World!

the result is depend on what box you submit or press enter in.

it does work please try it agin and only fill in one box at a time.



0
intheCommented:
did you change something in the code?
0
lxwizardAuthor Commented:
I know your program has no problem as well as mine. now, I only type in post box, and press post submit, but I can get nothing, post method do nothing.
in fact, I am going to install PWS on my computer and try our programs again. I will tell you the result. thank you again.
0
intheCommented:
hi
well that is strange :-(
for your info i am using samba web server but i didnt think it would make a difference ,url is:
http://www.sambar.com/
you install it and put your html file in the "docs" directory and the dll in the cgi-bin directory.the rest as normal it is quite asy to setup and use.i prefer it more than pws which i found can be a pain ;-)
let us know how it goes.
regards Barry
0
intheCommented:
ps it is also free .
0
lxwizardAuthor Commented:
Hi, dear friends.

I have used Samber,  then the result is:

POST method
Your request contains the following information:


Your IP address is: 127.0.0.1
Your POSTareaname is: Hello World!
Your GETareaname is:
You are using the following browser and operating system: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)
You asked for the following URL: http://127.0.0.1/cgi-bin/webquery.dll

GET method:
Your request contains the following information:


Your IP address is: 127.0.0.1
Your POSTareaname is:
Your GETareaname is: Hello World!
You are using the following browser and operating system: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)
You asked for the following URL: http://127.0.0.1/cgi-bin/webquery.dll

Just like my supposing, everything is OK, it means that Omnihttp has bugs, doesn¡¯t it?
Thank u. Then I have to use Samber rather then Omnihttp.
0
intheCommented:
yes it sure does :-)
you should tell the makers of Omnihttp about the problem,though ive just been reading newsgroups and other people have also found this bug so they probably know about it already.

ps
what do you think of sambar?
it quite good i think.
0
lxwizardAuthor Commented:
Thank u again, Samber is good, but its configuration is in HTML, I don't like this way. by the way, My ICQ number is :
15651977
0
intheCommented:
answered..
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
lxwizardAuthor Commented:
Thank u all, especially Inthe
0
intheCommented:
yeh thanks for the d grade it makes for great motivation to help people .
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.