ISAPI Question? 
Author Message
 ISAPI Question?

If this is the wrong group, please point me the the correct on. Here is my
question. Is there a why with ISAPI to parse my entire html page and grab
all the variables from all text boxes, check boxes, etc?

Thanks
Ralph Krausse



Mon, 07 Jan 2002 03:00:00 GMT  
 ISAPI Question?

Quote:
> If this is the wrong group, please point me the the correct on. Here is my
> question. Is there a why with ISAPI to parse my entire html page and grab
> all the variables from all text boxes, check boxes, etc?

Is there a reason you can't use a form submit and get at your variables in
the normal way?


Mon, 07 Jan 2002 03:00:00 GMT  
 ISAPI Question?
OK this might explain it better. I am not HTML expert but here goes. In the
first form I do have have
any buttons, just a text box called txtBox1. When I click my button I want
my ISAPI DLL to get the value
of txtBox1. Does that make sense?

thanks
Ralph

*********************************

<html>

<head>
<title>New Page 1</title>
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
</head>

<body>

<form method="POST" action="--WEBBOT-SELF--">
  <p><input type="text" name="txtBox1" size="20"></p>
</form>

<form method="POST" action="test.dll">
  <p><input type="text" name="txtBox2" size="20"><input type="submit"
value="Submit"
  name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>
</body>
</html>

Quote:


>> If this is the wrong group, please point me the the correct on. Here is
my
>> question. Is there a why with ISAPI to parse my entire html page and grab
>> all the variables from all text boxes, check boxes, etc?

>Is there a reason you can't use a form submit and get at your variables in
>the normal way?



Mon, 07 Jan 2002 03:00:00 GMT  
 ISAPI Question?

Quote:
> OK this might explain it better. I am not HTML expert but here goes. In
the
> first form I do have have
> any buttons, just a text box called txtBox1. When I click my button I want
> my ISAPI DLL to get the value
> of txtBox1. Does that make sense?

Yes, much more so.  You don't need to do that--the server sends you back
info in a predefined format that you can process yourself, or, if you
created an ISAPI Wizard app, you can do it via MFC's way.

I don't work with ISAPI, so I can't tell you how to do it, but there are
docs in MSDN--you should look there first.  Also, 15seconds.com has an ISAPI
mailing list you can get info on at http://www.15seconds.com/listserv.htm
and they can probably give you specific info.



Mon, 07 Jan 2002 03:00:00 GMT  
 ISAPI Question?
If I understand you correctly, you would do this by having some html code like
this...

    <FORM ACTION="/cgi-bin/A2K.dll"><INPUT TYPE="HIDDEN"
    NAME="MfcISAPICommand" VALUE="SendCommands">
    COMMAND STRING: <INPUT TYPE="TEXT" NAME="testnum1" VALUE="NONE"
MAXLENGTH="50" WIDTH="50" SIZE="50"><BR>

a map like this...
   ON_PARSE_COMMAND(SendCommands,CA2kExtension, ITS_PSTR ITS_PSTR ITS_I2 )
   ON_PARSE_COMMAND_PARAMS("testname=~ response=~ command=99")

with the prototype in your app header...

   void SendCommands(CHttpServerContext *req_obj, LPCTSTR testname, LPCTSTR
response, int command);

Hope this helps.

Quote:

> OK this might explain it better. I am not HTML expert but here goes. In the
> first form I do have have
> any buttons, just a text box called txtBox1. When I click my button I want
> my ISAPI DLL to get the value
> of txtBox1. Does that make sense?

> thanks
> Ralph

> *********************************

> <html>

> <head>
> <title>New Page 1</title>
> <meta name="GENERATOR" content="Microsoft FrontPage 3.0">
> </head>

> <body>

> <form method="POST" action="--WEBBOT-SELF--">
>   <p><input type="text" name="txtBox1" size="20"></p>
> </form>

> <form method="POST" action="test.dll">
>   <p><input type="text" name="txtBox2" size="20"><input type="submit"
> value="Submit"
>   name="B1"><input type="reset" value="Reset" name="B2"></p>
> </form>
> </body>
> </html>



> >> If this is the wrong group, please point me the the correct on. Here is
> my
> >> question. Is there a why with ISAPI to parse my entire html page and grab
> >> all the variables from all text boxes, check boxes, etc?

> >Is there a reason you can't use a form submit and get at your variables in
> >the normal way?



Tue, 08 Jan 2002 03:00:00 GMT  
 ISAPI Question?
First you have two separate forms. If you want the value of 'txtBox1' when
the submit button is clicked it needs to be in the same form.
i.e.

...
<body>

<form method="POST" action="test.dll">
    <p><input type="text" name="txtBox1" size="20"></p>
    <p>
        <input type="text" name="txtBox2" size="20">
        <input type="submit" value="Submit" name="B1">
        <input type="reset" value="Reset" name="B2">
    </p>
</form>

</body>
...

Assuming someone types 'foo' in the first text box and 'bar' in the second
text box, when the submit button is clicked the browser will send the
following query data to the web server (and your ISAPI extension).

txtBox1=foo&txtBox2=bar&B1=Submit

The query data is a set of name=value pairs delimited by '&'. The data above
indicates that the input element named 'txtBox1' had a value of 'foo'.

How you handle the incoming query data depends on how you are writing your
ISAPI extension. If you are using the MFC ISAPI Extension classes for
example you must do things the way MFC expects.

I don't recommended using the MFC ISAPI Extension for anything serious. They
suffer from numerous problems and limitations mostly stemming from a poor
design.

If you decide to parse the query string yourself find a good CGI reference.
ISAPI is very closely related to CGI. How you retrieve certain values is a
little different but what the values mean and how they should be treated is
virtually the same.

Quote:

>OK this might explain it better. I am not HTML expert but here goes. In the
>first form I do have have
>any buttons, just a text box called txtBox1. When I click my button I want
>my ISAPI DLL to get the value
>of txtBox1. Does that make sense?

>thanks
>Ralph

>*********************************

><html>

><head>
><title>New Page 1</title>
><meta name="GENERATOR" content="Microsoft FrontPage 3.0">
></head>

><body>

><form method="POST" action="--WEBBOT-SELF--">
>  <p><input type="text" name="txtBox1" size="20"></p>
></form>

><form method="POST" action="test.dll">
>  <p><input type="text" name="txtBox2" size="20"><input type="submit"
>value="Submit"
>  name="B1"><input type="reset" value="Reset" name="B2"></p>
></form>
></body>
></html>



>>> If this is the wrong group, please point me the the correct on. Here is
>my
>>> question. Is there a why with ISAPI to parse my entire html page and
grab
>>> all the variables from all text boxes, check boxes, etc?

>>Is there a reason you can't use a form submit and get at your variables in
>>the normal way?



Tue, 08 Jan 2002 03:00:00 GMT  
 ISAPI Question?
I don't want them to be in the same form....

thanks
Ralph


Quote:
> First you have two separate forms. If you want the value of 'txtBox1' when
> the submit button is clicked it needs to be in the same form.
> i.e.

> ...
> <body>

> <form method="POST" action="test.dll">
>     <p><input type="text" name="txtBox1" size="20"></p>
>     <p>
>         <input type="text" name="txtBox2" size="20">
>         <input type="submit" value="Submit" name="B1">
>         <input type="reset" value="Reset" name="B2">
>     </p>
> </form>

> </body>
> ...

> Assuming someone types 'foo' in the first text box and 'bar' in the second
> text box, when the submit button is clicked the browser will send the
> following query data to the web server (and your ISAPI extension).

> txtBox1=foo&txtBox2=bar&B1=Submit

> The query data is a set of name=value pairs delimited by '&'. The data
above
> indicates that the input element named 'txtBox1' had a value of 'foo'.

> How you handle the incoming query data depends on how you are writing your
> ISAPI extension. If you are using the MFC ISAPI Extension classes for
> example you must do things the way MFC expects.

> I don't recommended using the MFC ISAPI Extension for anything serious.
They
> suffer from numerous problems and limitations mostly stemming from a poor
> design.

> If you decide to parse the query string yourself find a good CGI
reference.
> ISAPI is very closely related to CGI. How you retrieve certain values is a
> little different but what the values mean and how they should be treated
is
> virtually the same.


> >OK this might explain it better. I am not HTML expert but here goes. In
the
> >first form I do have have
> >any buttons, just a text box called txtBox1. When I click my button I
want
> >my ISAPI DLL to get the value
> >of txtBox1. Does that make sense?

> >thanks
> >Ralph

> >*********************************

> ><html>

> ><head>
> ><title>New Page 1</title>
> ><meta name="GENERATOR" content="Microsoft FrontPage 3.0">
> ></head>

> ><body>

> ><form method="POST" action="--WEBBOT-SELF--">
> >  <p><input type="text" name="txtBox1" size="20"></p>
> ></form>

> ><form method="POST" action="test.dll">
> >  <p><input type="text" name="txtBox2" size="20"><input type="submit"
> >value="Submit"
> >  name="B1"><input type="reset" value="Reset" name="B2"></p>
> ></form>
> ></body>
> ></html>



> >>> If this is the wrong group, please point me the the correct on. Here
is
> >my
> >>> question. Is there a why with ISAPI to parse my entire html page and
> grab
> >>> all the variables from all text boxes, check boxes, etc?

> >>Is there a reason you can't use a form submit and get at your variables
in
> >>the normal way?



Wed, 09 Jan 2002 03:00:00 GMT  
 ISAPI Question?
Let me ask this differently. How can I get the value of a variable in a
different form?


Quote:
> I don't want them to be in the same form....

> thanks
> Ralph



> > First you have two separate forms. If you want the value of 'txtBox1'
when
> > the submit button is clicked it needs to be in the same form.
> > i.e.

> > ...
> > <body>

> > <form method="POST" action="test.dll">
> >     <p><input type="text" name="txtBox1" size="20"></p>
> >     <p>
> >         <input type="text" name="txtBox2" size="20">
> >         <input type="submit" value="Submit" name="B1">
> >         <input type="reset" value="Reset" name="B2">
> >     </p>
> > </form>

> > </body>
> > ...

> > Assuming someone types 'foo' in the first text box and 'bar' in the
second
> > text box, when the submit button is clicked the browser will send the
> > following query data to the web server (and your ISAPI extension).

> > txtBox1=foo&txtBox2=bar&B1=Submit

> > The query data is a set of name=value pairs delimited by '&'. The data
> above
> > indicates that the input element named 'txtBox1' had a value of 'foo'.

> > How you handle the incoming query data depends on how you are writing
your
> > ISAPI extension. If you are using the MFC ISAPI Extension classes for
> > example you must do things the way MFC expects.

> > I don't recommended using the MFC ISAPI Extension for anything serious.
> They
> > suffer from numerous problems and limitations mostly stemming from a
poor
> > design.

> > If you decide to parse the query string yourself find a good CGI
> reference.
> > ISAPI is very closely related to CGI. How you retrieve certain values is
a
> > little different but what the values mean and how they should be treated
> is
> > virtually the same.


> > >OK this might explain it better. I am not HTML expert but here goes. In
> the
> > >first form I do have have
> > >any buttons, just a text box called txtBox1. When I click my button I
> want
> > >my ISAPI DLL to get the value
> > >of txtBox1. Does that make sense?

> > >thanks
> > >Ralph

> > >*********************************

> > ><html>

> > ><head>
> > ><title>New Page 1</title>
> > ><meta name="GENERATOR" content="Microsoft FrontPage 3.0">
> > ></head>

> > ><body>

> > ><form method="POST" action="--WEBBOT-SELF--">
> > >  <p><input type="text" name="txtBox1" size="20"></p>
> > ></form>

> > ><form method="POST" action="test.dll">
> > >  <p><input type="text" name="txtBox2" size="20"><input type="submit"
> > >value="Submit"
> > >  name="B1"><input type="reset" value="Reset" name="B2"></p>
> > ></form>
> > ></body>
> > ></html>



> > >>> If this is the wrong group, please point me the the correct on. Here
> is
> > >my
> > >>> question. Is there a why with ISAPI to parse my entire html page and
> > grab
> > >>> all the variables from all text boxes, check boxes, etc?

> > >>Is there a reason you can't use a form submit and get at your
variables
> in
> > >>the normal way?



Wed, 09 Jan 2002 03:00:00 GMT  
 ISAPI Question?

Quote:
> Let me ask this differently. How can I get the value of a variable in a
> different form?

Client-side scripting.


Wed, 09 Jan 2002 03:00:00 GMT  
 ISAPI Question?
OK thanks but I guess is what I am looking for. I need to figure out a way
to create a bunch of html pages without creating a bunch of isapi dlls for
each one. I would like to maybe have the isapi dll read in the varible names
from, i don't know, an ini file, and grab the values. Is this possible?

thanks
r-


Quote:


> > Let me ask this differently. How can I get the value of a variable in a
> > different form?

> Client-side scripting.



Fri, 11 Jan 2002 03:00:00 GMT  
 ISAPI Question?
I'm still confused on what you are trying to do. You could write varible values
to a file and read them back. Or you can simply save the values in a class. The
point is that the dll can have a virtually unlimited amount of form functions, a
class can remember the values from call to call, the dll does not terminate
unless explicitly told to or the server dies, etc. Furthermore, you can decide
at run time which file you send to server,  such as...

void CCalcertExtension::specs(CHttpServerContext* pCtxt, LPCTSTR cmd)
{
CLimits l1;
CString csTmp;
csTmp = (LPCTSTR)cmd;//could be a hidden var, radio button, whatever.

   csTmp.MakeUpper();

   if(csTmp.Find("~")!=-1)
    *pCtxt << l1.draw_getsystemtable();
   else if (csTmp.Find("A1000 T")!=-1)     *pCtxt << l1.draw_setsystemtable(0,
"NONE");//A1000's
   else if(csTmp.Find("A100 T")!=-1)
     *pCtxt << l1.draw_setsystemtable(1, "NONE");//A100's
   else if(csTmp.Find("A10 T")!=-1)
     *pCtxt << l1.draw_setsystemtable(2, "NONE");//A10's

where each function call has something like...

    CString csSendHtml;
    if ((out= fopen ("\\WWWROOT\\HTML\\CERTHELP.HTM", "r")) == NULL)
      {
      sprintf (pass_err, "FILE ERROR OPENING HTML DOCUMENT
\\WWWROOT\\HTML\\CERTHELP.HTM");
      *req_obj << s1.GenericFormError(pass_err, 205);
      }
    else
      {
      while (fgets(s1.buffer, sizeof(s1.buffer), out) != NULL)
        csSendHtml += (LPSTR) s1.buffer;
      fclose(out);
      *req_obj << csSendHtml;
      }

This may not be what you are asking for. If not, supply some more details and I
might be able to help more.

Quote:

> OK thanks but I guess is what I am looking for. I need to figure out a way
> to create a bunch of html pages without creating a bunch of isapi dlls for
> each one. I would like to maybe have the isapi dll read in the varible names
> from, i don't know, an ini file, and grab the values. Is this possible?

> thanks
> r-





> > > Let me ask this differently. How can I get the value of a variable in a
> > > different form?

> > Client-side scripting.



Fri, 11 Jan 2002 03:00:00 GMT  
 ISAPI Question?
Yes. Don't use the MFC ISAPI Extension classes. The business of having one
function per form 'hard-coded' to a pre-known set of names is a bogus
limitation imposed by the MFC ISAPI Extension classes which were modeled on
DDX instead of CGI common practice.

ISAPI itself is very closely modeled on CGI. Typically in CGI programming
(and ASP) you deal with a dynamic collection or map of name/value pairs. On
any given request you can determine what names were actually sent and act
accordingly. It is also typical in CGI (and non-MFC ISAPI) programming to
have the same program both create the form and process the form.

i.e.
foo.html may contain:
<a href="test.dll">Click Here</a>

The output may contain:

<form method="POST" action="test.dll">
<input type="hidden" name="state" value="1">
...
</form>

Basically test.dll might look for "state". If "state" was not passed,
display the form; otherwise process the form data. Note that state could
have many valid values representing a chain of pages all produced and
processed by the same DLL.

Since the ISAPI DLL is both the creator and the processor the input element
names don't need to be external in an .ini file. Instead they can be
constant strings in your C++ code.

If you decide to write directly to ISAPI take a look at the std::multimap
container class in the C++ Standard Library and check out the CGI docs at
<http://hoohoo.ncsa.uiuc.edu/cgi>. How/where you get certain values will
differ between CGI and ISAPI but the correct way to decode the inbound data
is the same. ISAPI is documented in the IIS SDK. The IIS SDK is included in
the Platform SDK and with IIS 4.0.


Quote:
>OK thanks but I guess is what I am looking for. I need to figure out a way
>to create a bunch of html pages without creating a bunch of isapi dlls for
>each one. I would like to maybe have the isapi dll read in the varible
names
>from, i don't know, an ini file, and grab the values. Is this possible?

>thanks
>r-





>> > Let me ask this differently. How can I get the value of a variable in a
>> > different form?

>> Client-side scripting.



Fri, 11 Jan 2002 03:00:00 GMT  
 ISAPI Question?

Quote:
> Yes. Don't use the MFC ISAPI Extension classes. The business of having one
> function per form 'hard-coded' to a pre-known set of names is a bogus
> limitation imposed by the MFC ISAPI Extension classes which were modeled
on
> DDX instead of CGI common practice.

And on top of that, the MFC way of http://server/isapi.dll?function?... is
incorrect HTML--a URL should only have one question mark.

Quote:
> ISAPI itself is very closely modeled on CGI. Typically in CGI programming
> (and ASP) you deal with a dynamic collection or map of name/value pairs.
On
> any given request you can determine what names were actually sent and act
> accordingly. It is also typical in CGI (and non-MFC ISAPI) programming to
> have the same program both create the form and process the form.

I agree.  It's not too hard to parse out the stuff you're interested in--you
might even be able to use flex (or is it bison?) to build a parser for you.


Fri, 11 Jan 2002 03:00:00 GMT  
 ISAPI Question?
Thanks Jonathan,

    But I guess I am looking for someone to tell how to get the values that
aren't
passed in.

Thanks but I am starting to think ISAPI is worthless for real development
Ralph


Quote:
> Yes. Don't use the MFC ISAPI Extension classes. The business of having one
> function per form 'hard-coded' to a pre-known set of names is a bogus
> limitation imposed by the MFC ISAPI Extension classes which were modeled
on
> DDX instead of CGI common practice.

> ISAPI itself is very closely modeled on CGI. Typically in CGI programming
> (and ASP) you deal with a dynamic collection or map of name/value pairs.
On
> any given request you can determine what names were actually sent and act
> accordingly. It is also typical in CGI (and non-MFC ISAPI) programming to
> have the same program both create the form and process the form.

> i.e.
> foo.html may contain:
> <a href="test.dll">Click Here</a>

> The output may contain:

> <form method="POST" action="test.dll">
> <input type="hidden" name="state" value="1">
> ...
> </form>

> Basically test.dll might look for "state". If "state" was not passed,
> display the form; otherwise process the form data. Note that state could
> have many valid values representing a chain of pages all produced and
> processed by the same DLL.

> Since the ISAPI DLL is both the creator and the processor the input
element
> names don't need to be external in an .ini file. Instead they can be
> constant strings in your C++ code.

> If you decide to write directly to ISAPI take a look at the std::multimap
> container class in the C++ Standard Library and check out the CGI docs at
> <http://hoohoo.ncsa.uiuc.edu/cgi>. How/where you get certain values will
> differ between CGI and ISAPI but the correct way to decode the inbound
data
> is the same. ISAPI is documented in the IIS SDK. The IIS SDK is included
in
> the Platform SDK and with IIS 4.0.



> >OK thanks but I guess is what I am looking for. I need to figure out a
way
> >to create a bunch of html pages without creating a bunch of isapi dlls
for
> >each one. I would like to maybe have the isapi dll read in the varible
> names
> >from, i don't know, an ini file, and grab the values. Is this possible?

> >thanks
> >r-





> >> > Let me ask this differently. How can I get the value of a variable in
a
> >> > different form?

> >> Client-side scripting.



Sat, 12 Jan 2002 03:00:00 GMT  
 ISAPI Question?

Quote:
>     But I guess I am looking for someone to tell how to get the values
that
> aren't
> passed in.

Huh?  If you don't pass a value back in, you'll get nothing back at the
server.  Read up on how HTML handles forms, or, better yet, write a little
program that'll sit on port 81, and display the data thrown at it, then have
a form point to that program.  It's edifying.

Quote:
> Thanks but I am starting to think ISAPI is worthless for real development

I doubt MSN or Microsoft would agree with you.  ASP is an ISAPI filter.


Sat, 12 Jan 2002 03:00:00 GMT  
 
 [ 17 post ]  Go to page: [1] [2]

 Relevant Pages 

1. ISAPI question

2. ISAPI Question on processing Tags

3. newbie ISAPI question

4. ISAPI Question

5. C++/MFC/HTTP/ISAPI Question of Death

6. ISAPI question

7. ISAPI Question.

8. HLP: ISAPI question

9. ISAPI DB Question

10. ISAPI Extension question - serving filename

11. ISAPI thread question

12. ISAPI Multi-Post Question

 

 
Powered by phpBB® Forum Software