I'm trying to create a CGI Perl script for an IIS 3.0 server, but even the
most basic commands create problems for IE 3.0 and Netscape Navigator 3.0.
The code I wrote is:
print "Location: /order.html\n\n";
In IE 3.0 the result is a page with:
Location: /order.html
Netscape always asks me to save the file.
If anybody have at least an idea about what the problem could be, please
reply as soon as possible here and at my EMail address:
pa...@integration.qc.ca
Thank you!
Paul
For more info, see the FAQ pointed to in the Perl ISAPI docs.
Ade.
Paul-Catalin Oros <pa...@integration.qc.ca> wrote in article
<01bbfddd$d41d4b70$11f6eccd@arrakis>...
Paul-Catalin Oros <pa...@integration.qc.ca> wrote in article
<01bbfddd$d41d4b70$11f6eccd@arrakis>...
> Hi,
>
> I'm trying to create a CGI Perl script for an IIS 3.0 server, but even
the
> most basic commands create problems for IE 3.0 and Netscape Navigator
3.0.
> The code I wrote is:
>
> print "Location: /order.html\n\n";
>
> In IE 3.0 the result is a page with:
>
> Location: /order.html
>
Here's the reason: the URL cannot be relative - it has to do with HTTP
being a stateless protocol. Make sure that you include a complete URL to
the document. If you don't want to have to include the sever name in the
program (although it's interpreted so it wouldn't be hard to change) use
the SERVER_NAME variable. Also, make sure that you return a redirection
header (301 or 302 will work) instead of a 200 OK.
Hope it helped!
-- Chris...@activelabs.com
>Hi,
>
>I'm trying to create a CGI Perl script for an IIS 3.0 server, but even the
>most basic commands create problems for IE 3.0 and Netscape Navigator 3.0.
>The code I wrote is:
>
>print "Location: /order.html\n\n";
>
>In IE 3.0 the result is a page with:
>
>Location: /order.html
>
>Netscape always asks me to save the file.
>
>If anybody have at least an idea about what the problem could be, please
>reply as soon as possible here and at my EMail address:
>pa...@integration.qc.ca
>
>Thank you!
>
> Paul
>
You need to send the standard http headers first so that Netscape
knows its a html document. IE is more forgiving of missing bits
try
print "HTTP/1.0 200 OK\n";
print "Content-type: text/html\n\n";
print "<HTML><HEAD></HEAD>" ;
print "Location: /order.html\n\n";
If you need any more info you may want to look at some of the perl/cgi
newsgroups
comp.lang.perl.misc
comp.infosystems.www.authoring.cgi
ttfn
Simon Fell
Thank you for your reply. I finaly got it to work in IE 3.0, but now I
have problems under Netscape Navigator Gold 3.0 The code I use is:
print "HTTP/1.0 303 See OtherOK\n";
print <<"END";
Content-type: text/html
Location: www.server.com/page.html
END
This works well in IE 3.0 but I can't get it to work in Navigator. It
would be great if somebody could post just a few lines of Perl code that
works for Navigator also.
Regards,
Paul
Adrian Bateman wrote:
>
> If you are using the Perl ISAPI extension, you must treat Perl scripts as
> non-parsed header scripts and write out the correct HTTP response e.g.
> HTTP/1.0 200 OK or HTTP/1.0 302 Moved.
>
> For more info, see the FAQ pointed to in the Perl ISAPI docs.
>
> Ade.
>
> Paul-Catalin Oros <pa...@integration.qc.ca> wrote in article
> <01bbfddd$d41d4b70$11f6eccd@arrakis>...
Try this:
if ($ENV{'SERVER_SOFTWARE'} eq
'Microsoft-Internet-Information-Server/1.0')
{
print "status: 301 Document Moved\n";
print "Location: http://blah.blah.blah/foo.html\n\n";
}
else
{
print "HTTP/1.0 301 Document Moved\n";
print "Location: http://blah.blah.blah/scripts/foo.pl\n\n";
}