Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

QUERY_STRING into SSI with exec cgi and IIS 6.0

21 views
Skip to first unread message

benwylie

unread,
Oct 12, 2006, 8:15:45 PM10/12/06
to
I have a perl script which runs as an ssi in an shtml page.
I need to be able to grab the url parameters and stick them in the ssi
as parameters as well (aparently in IIS 5 this was done automatically,
but in IIS 6.0 it can't use get to collect the parameters from the
parent url.

Is there a way i can get it to collect the URL parameters and bring
them into the ssi?
The parent url is

http://www.domain.com/docsearch.shtml?go=1&start=+1&startyr=2002&end=12&endyr=2002&sort=date&format=Any&title=&go=1

The ssi is:
<form action='docsearch.shtml' method='get'>
<!--#exec cgi="/cgi-bin/docsearch.pl-->
</form>

On this page:
http://blogs.msdn.com/david.wang/archive/2005/12/12/Child_URL_Execution_and_SSI_exec_Redux.aspx
it seems to be able to say it is possible:
"One way to work with this on IIS6 is to modify your CGI to take in a
querystring or other parameter from the URL, and for SHTML pages
containing #exec statements to denote the exact URL whose page-counter
you want to increment."
but it doesn't say how you take in the querystring to the ssi.

One guy said he tried this:
<!--#exec cgi="/cgi-bin/docsearch.pl?<!--#echo var="QUERY_STRING" -->"
-->

another this:
<!--#set var="body" value="/cgi-bin/docsearch.pl?${QUERY_STRING}"-->
<!--#exec cgi="${body}" --> ?

another this:
<!--#exec cgi="/cgi-bin/docsearch.pl?${QUERY_STRING}" -->

and another this:
<!--#exec cgi="/cgi-bin/docsearch.pl?$ENV{'QUERY_STRING'}" -->
None of these work.

Any ideas on how I can get the query string into the ssi?

Thanks
Ben

David Wang

unread,
Oct 13, 2006, 5:46:20 AM10/13/06
to
The blog entry you quoted does not mean what you interpreted. The blog
entry suggests the CGI to take in a querystring as parameter, and for
the #exec to hard code the appropriate URL as querystring for the CGI.

I am not an expert of the SSI implementation on IIS, but I do not
believe what you want is possible - because I do not see a syntax in
SSI implementation on IIS to dereference any parent server variable
values and dynamically pass it to the child URL of the #exec statement.


<!--#exec cgi="/cgi-bin/docsearch.pl?<!--#echo var="QUERY_STRING" -->"

As documented, #echo will write the QUERY_STRING back to the client --
not pass it to the #exec -- so it's not what you want.


<!--#set var="body" value="/cgi-bin/docsearch.pl?${QUERY_STRING}"-->
<!--#exec cgi="${body}" --> ?

<!--#exec cgi="/cgi-bin/docsearch.pl?${QUERY_STRING}" -->

<!--#exec cgi="/cgi-bin/docsearch.pl?$ENV{'QUERY_STRING'}" -->

Now, they may be valid on other web servers running other SSI
implementations, but none of these are valid syntax in SSI
implementation on IIS.

Personally, I suggest changing this to a simple ASP page which will
easily do exactly what you want because it actually has the
functionality you want, by intention, and is supported.


//David
http://w3-4u.blogspot.com
//

benwylie

unread,
Oct 16, 2006, 9:42:30 PM10/16/06
to
David Wang wrote:
<snip>

> Personally, I suggest changing this to a simple ASP page which will
> easily do exactly what you want because it actually has the
> functionality you want, by intention, and is supported.

Thanks David for your response.

Could you point me to a page which will explain how to run a perl
script from an asp page?
I have tried the format used on:
http://www.wrensoft.com/zoom/support/faq_ssi.html
but whether I have a .pl or .cgi ending it claims that the perl script
is not a valid Win32 application.

My PATH contains F:\Perl\bin\ and my PATHEXT includes .PL;.CGI which
one page seemed to say was required.

If I just run the perl script it runs correctly, with the file
association linked to the Perl command line interpreter.

Thanks for your help,

Ben

0 new messages