[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

A problem about ISAPI

Posted on 2000-01-20
23
Medium Priority
?
217 Views
Last Modified: 2010-04-04
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
0
Comment
Question by:lxwizard
  • 10
  • 9
  • 2
  • +2
23 Comments
 
LVL 17

Expert Comment

by:inthe
ID: 2373176
Hi
do you want
Request.ContentFields.Values['area']

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

0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 2373181
Listening
0
 
LVL 17

Expert Comment

by:inthe
ID: 2373185
btw:
i think you will like this website :

http://www.209software.com/books/wpid/
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 

Author Comment

by:lxwizard
ID: 2373283
Edited text of question.
0
 

Author Comment

by:lxwizard
ID: 2373287
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
 
LVL 17

Expert Comment

by:geobul
ID: 2374057
Hi,

1.Check that WebActionItem1.MethodType is mtAny.

2. Input : TStringS;

Regards, Geo
0
 
LVL 17

Expert Comment

by:geobul
ID: 2374075
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
 
LVL 4

Expert Comment

by:Radler
ID: 2375952
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
 
LVL 17

Expert Comment

by:inthe
ID: 2376449
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
 

Author Comment

by:lxwizard
ID: 2376744
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
 

Author Comment

by:lxwizard
ID: 2376752
Nobody can make a solution.
The problem is still here.
0
 

Author Comment

by:lxwizard
ID: 2376761
Nobody can make a solution.
The problem is still here.
0
 
LVL 17

Expert Comment

by:inthe
ID: 2376792
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
 
LVL 17

Expert Comment

by:inthe
ID: 2376794
did you change something in the code?
0
 

Author Comment

by:lxwizard
ID: 2376813
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
 
LVL 17

Expert Comment

by:inthe
ID: 2376823
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
 
LVL 17

Expert Comment

by:inthe
ID: 2376827
ps it is also free .
0
 

Author Comment

by:lxwizard
ID: 2376996
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
 
LVL 17

Expert Comment

by:inthe
ID: 2377013
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
 

Author Comment

by:lxwizard
ID: 2377098
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
 
LVL 17

Accepted Solution

by:
inthe earned 100 total points
ID: 2423921
answered..
0
 

Author Comment

by:lxwizard
ID: 2460847
Thank u all, especially Inthe
0
 
LVL 17

Expert Comment

by:inthe
ID: 2461841
yeh thanks for the d grade it makes for great motivation to help people .
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

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

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…
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…
The video provides a quick and easy steps to migrate MBOX file to well known Outlook PST and Office 365. Besides this, it also supports and migrates more than 20 email clients of MBOX which include AppleMail, Opera, Thunderbird and SeaMonkey effortl…
Free Data Recovery software is an advanced solution from Kernel Tools to recover data and files such as documents, emails, database, media and pictures, etc. It supports recovery from physical & logical drive after a hard disk crash, accidental/inte…
Suggested Courses

612 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