jfbeaulieu
asked on
current path with stdout (or remove the result page)
I'm posting a form with target="_self" in the html code
(action= "...." target="_self")
I have a cgi which is sending back some data to stdout,
mainly an html page. The problem is that this page is a
predefined page that is using images from the server's
hard drive, and my default directory for the data which is
sent back is cgi-bin rather than the directory from which the post was done. My adress line in the browser gives:
http:...../cgi-bin/question.htm when the data is sent back
rather than the one from which question.htm was read, so the
images can't be found. Is there a way to change this (my cgi
is in "c") or either a way to eliminate the need to send back some data or open a new window once a cgi is executed?
If I'm not sending back something on stdout the IIS server is giving me an error, but all I want is to stay on the same
page after a post, without an intermediate screen with an hyperlink..
(action= "...." target="_self")
I have a cgi which is sending back some data to stdout,
mainly an html page. The problem is that this page is a
predefined page that is using images from the server's
hard drive, and my default directory for the data which is
sent back is cgi-bin rather than the directory from which the post was done. My adress line in the browser gives:
http:...../cgi-bin/question.htm when the data is sent back
rather than the one from which question.htm was read, so the
images can't be found. Is there a way to change this (my cgi
is in "c") or either a way to eliminate the need to send back some data or open a new window once a cgi is executed?
If I'm not sending back something on stdout the IIS server is giving me an error, but all I want is to stay on the same
page after a post, without an intermediate screen with an hyperlink..
I hate forms which give you very little indication they have succeeded... I would have suggested instead that you fix the page your CGI puts out, either by inserting a <BASE HREF> tag so the images work, or by using a Location: header (which seems pretty much the same as the URI header, I've never heard of the URI header - is it general or for O'Reilly's server only?)
Above post completed...
Location:
Same as URI, but this form is now deprecated. The value
must not be enclosed in abngle brackets with this
form.
So, URI _is_ the same as Location.
-K
Location:
Same as URI, but this form is now deprecated. The value
must not be enclosed in abngle brackets with this
form.
So, URI _is_ the same as Location.
-K
Thanks, rets.
ASKER
I'm sorry, but it doesn't seems to work. I've try the following
lines in my cgi:
fprintf(stdout,"Content-ty pe: text/html\n");
fprintf(stdout,"Status:200 OK\n");
fprintf(stdout,"\n");
fprintf(stdout, "URI:<http://Plaisirdelire.sympatico.ca/index.htm>");
and also with URL rather than URI, it doesn't seems to open the page but it is just displaying on the left top:
URI and the remaining of the page is blank
lines in my cgi:
fprintf(stdout,"Content-ty
fprintf(stdout,"Status:200
fprintf(stdout,"\n");
fprintf(stdout, "URI:<http://Plaisirdelire.sympatico.ca/index.htm>");
and also with URL rather than URI, it doesn't seems to open the page but it is just displaying on the left top:
URI and the remaining of the page is blank
No Content-type: the FIRST thing out must be
URI: <http://www.myserver.com/myform.html>
So, you should have your CGI say:
fprintf(stdout, "URI: <http://www.myserver.com/myform.html>\n\n");
and forget anything else that prints (because the user will be sent to http://www.myserver.com/myform.html.
Let me know if you've any more questions (I get notified on updates.)
URI: <http://www.myserver.com/myform.html>
So, you should have your CGI say:
fprintf(stdout, "URI: <http://www.myserver.com/myform.html>\n\n");
and forget anything else that prints (because the user will be sent to http://www.myserver.com/myform.html.
Let me know if you've any more questions (I get notified on updates.)
ASKER
Hi,
>No Content-type: the FIRST thing out must be
>URI: <http://www.myserver.com/myform.html>
>So, you should have your CGI say:
>fprintf(stdout, "URI: <http://www.myserver.com/myform.html>>
\n\n");
I did it and there's some progress: when I test it locally
with IIS and my own computer's adress there is a blank page
because the adress which is display in the upper field is:
http://192.168.0.33/plaisirdelire/cgi-in/<..../question/ques.htm>
rather than
the value between <.../question/ques.htm>
there seems to be a concatenation here, my form which is calling
the cgi has a 'target="_top"' or either target="_self" after
the verb "ACTION=..."
I called the cgi with http://192.168.0.33/ question.htm
which contain the form...
Any idea?
>No Content-type: the FIRST thing out must be
>URI: <http://www.myserver.com/myform.html>
>So, you should have your CGI say:
>fprintf(stdout, "URI: <http://www.myserver.com/myform.html>>
\n\n");
I did it and there's some progress: when I test it locally
with IIS and my own computer's adress there is a blank page
because the adress which is display in the upper field is:
http://192.168.0.33/plaisirdelire/cgi-in/<..../question/ques.htm>
rather than
the value between <.../question/ques.htm>
there seems to be a concatenation here, my form which is calling
the cgi has a 'target="_top"' or either target="_self" after
the verb "ACTION=..."
I called the cgi with http://192.168.0.33/ question.htm
which contain the form...
Any idea?
If you would like the user to end up at:
http://192.168.0.33/question.htm
then you should say:
printf(stdout, "URI: <http://192.168.0.33/question.htm>\n\n");
What did the last revision of your code look like? As an aside, you may wish to try
printf(stdout, "Location: http://192.168.0.33/question.htm\n\n");
as alamo suggested. Perhaps IIS doesn't like URI.
-K
http://192.168.0.33/question.htm
then you should say:
printf(stdout, "URI: <http://192.168.0.33/question.htm>\n\n");
What did the last revision of your code look like? As an aside, you may wish to try
printf(stdout, "Location: http://192.168.0.33/question.htm\n\n");
as alamo suggested. Perhaps IIS doesn't like URI.
-K
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks to all of them, I had to postpone my tests since my my Hard drive was crashed but it works well
The server recognizes to following header lines in the results data stream:
Content-type:
...
URI: <value> (value enclosed in angle brackets)
The value is either a full URL or a local file reference, either of which points to an object to be returned to the client in lieu of the body. If the value is a local file, the server sends it as the results of the request, as though the client issued a GET for that object. If the value is a full URL, the server returns a "401 redirect" to the client to retrieve the specified object directly.
Location:
...
So. If you can have the CGI print out the following before anything else, you will reload the page you started at:
URI: <http://www.myserver.com/myform.html>