create and send a form server side

G

Giorgio

Hi,
by clicking a link to an ASP page I'd like to create a form (and send its
data) all server side, the client should only see the page that retrieves
data.

Please help me
Thanks!
 
G

Giorgio

See:

Thanks a lot , I'd like this:
- page1 creates and sends the form
- page2 has some Request.Form only.

After page1 sends the form I'd like to go to page2, not to remain in page1
From the title of your link it seems that I will remain in page1 and only
read page2
Or does that link explain also what I'd like to do?
 
B

Bob Barrows

Giorgio said:
Thanks a lot , I'd like this:
- page1 creates and sends the form
- page2 has some Request.Form only.

After page1 sends the form I'd like to go to page2, not to remain in
page1 From the title of your link it seems that I will remain in
page1 and only read page2
Or does that link explain also what I'd like to do?

?? You've never heard of Response.Redirect?
See:
http://www.aspfaq.com/show.asp?id=2006
and
http://www.aspfaq.com/show.asp?id=2030

Maybe I am failing to understand your requirements.
 
G

Giorgio

Thanks for reply.
I forgot to say that I cannot modify page2 (it's on another server).
Page2 requires to have data sent by form's method post cause page2 has
Request.Form.

I'd like to simulate in page1 a form sent by the client but server side (I
have values to send to page2).
 
B

Bob Barrows

Giorgio said:
Thanks for reply.
I forgot to say that I cannot modify page2 (it's on another server).
Page2 requires to have data sent by form's method post cause page2 has
Request.Form.

I'd like to simulate in page1 a form sent by the client but server
side (I have values to send to page2).

Well, the article I posted talks specifically about this.
 
G

Giorgio

Bob Barrows said:
Well, the article I posted talks specifically about this.

I tried: I can only show page2 content (without style because page2 is on
another server) but I still remain in page1 (see addreess bar) and I'm not
redirected to page2 while posting data.
Please could you help me again?

This is my code:
<%
strPostURL =
"http://ecommerce.plusvalore.it:7081/CaricamentoCO/Login/loginTarida.jsp"
strPost =
"fasePagina=check&Lgn_operatore=USERNAME&Lgn_password=PASSWORD&MM_action=true"
set objPost = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
objPost.Open "POST", strPostURL, False
objPost.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objPost.send strPost
strTheResponse = objPost.responseText
Response.write strTheResponse
%>


I'd like to have somethig similar to this (done with javacript see below),
but server side because I dont want to send password to client again.

<form name="form1" method="post" target="_blank"
action="http://ecommerce.plusvalore.it:7081/CaricamentoCO/Login/loginTarida.jsp">
<input name="fasePagina" type="hidden" value="check">
<input type="hidden" id="Lgn_operatore" name="Lgn_operatore"
value="USERNAME">
<input type="hidden" id="Lgn_password" name="Lgn_password"
value="PASSWORD">
<input type="hidden" id="MM_action" name="MM_action" value="true">
</form>

<script>
document.form1.submit();
</script>
 
D

Daniel Crichton

Giorgio wrote on Fri, 22 May 2009 13:13:44 GMT:

I tried: I can only show page2 content (without style because page2 is
on another server) but I still remain in page1 (see addreess bar) and
I'm not redirected to page2 while posting data.
Please could you help me again?
This is my code:
<%
strPostURL =
"http://ecommerce.plusvalore.it:7081/CaricamentoCO/Login/loginTarida.
jsp"
strPost =
"fasePagina=check&Lgn_operatore=USERNAME&Lgn_password=PASSWORD&MM_
action=true"
set objPost = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
objPost.Open "POST", strPostURL, False objPost.setRequestHeader
"Content-Type", "application/x-www-form-urlencoded"
objPost.send strPost strTheResponse = objPost.responseText
Response.write strTheResponse %>

I'd like to have somethig similar to this (done with javacript see
below), but server side because I dont want to send password to client
again.
<form name="form1" method="post" target="_blank"
action="http://ecommerce.plusvalore.it:7081/CaricamentoCO/Login/
loginTarida.jsp">
<input name="fasePagina" type="hidden" value="check">
<input type="hidden" id="Lgn_operatore" name="Lgn_operatore"
value="USERNAME">
<input type="hidden" id="Lgn_password" name="Lgn_password"
value="PASSWORD">
<input type="hidden" id="MM_action" name="MM_action" value="true">
</form>
<script>
document.form1.submit();
</script>


The code you're using posts the data on the server side from page1 to page2,
so of course you remain on page1 in the URL. The only way to have it work
the way you expect it to is to get the client to post the form data, and
that will require you to use the second method (and that's client side, not
server side, and by it's nature it *must* be client side). So you have to
decide what is more important - the URL, or the not passing the password to
the client? You cannot have both!
 
B

Bob Barrows

Giorgio said:
I tried: I can only show page2 content (without style because page2
is on another server) but I still remain in page1 (see addreess bar)
and I'm not redirected to page2 while posting data.
Please could you help me again?

This is my code:
<%
strPostURL =
"http://ecommerce.plusvalore.it:7081/CaricamentoCO/Login/loginTarida.jsp"
strPost =
"fasePagina=check&Lgn_operatore=USERNAME&Lgn_password=PASSWORD&MM_action=true"
set objPost = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
objPost.Open "POST", strPostURL, False
objPost.setRequestHeader "Content-Type",
"application/x-www-form-urlencoded" objPost.send strPost
strTheResponse = objPost.responseText
Response.write strTheResponse
%>


I'd like to have somethig similar to this (done with javacript see
below), but server side because I dont want to send password to client
again.

<form name="form1" method="post" target="_blank"
action="http://ecommerce.plusvalore.it:7081/CaricamentoCO/Login/loginTarida.jsp">
<input name="fasePagina" type="hidden" value="check">
<input type="hidden" id="Lgn_operatore" name="Lgn_operatore"
value="USERNAME">
<input type="hidden" id="Lgn_password" name="Lgn_password"
value="PASSWORD">
<input type="hidden" id="MM_action" name="MM_action" value="true">
</form>

<script>
document.form1.submit();
</script>

I'm afraid you are out of luck. You cannot transfer a posted request to a
page on another server. If the page was on the same server, you could use
server.transfer.
 
G

Giorgio

The code you're using posts the data on the server side from page1 to
page2,
so of course you remain on page1 in the URL. The only way to have it work
the way you expect it to is to get the client to post the form data, and
that will require you to use the second method (and that's client side,
not server side, and by it's nature it *must* be client side). So you have
to decide what is more important - the URL, or the not passing the
password to the client? You cannot have both!

Thanks,
it's more important not passing the password.
But I remain in page1 and, once logged, relative links in page2 are shown
(inside page1) and they will not work.

(Moreover page2 content says that I'm logged but Session variables of page2
are not set cause I'm on page1 server)

Do you know any other solutions?
 
D

Daniel Crichton

Giorgio wrote on Fri, 22 May 2009 14:27:26 GMT:

Thanks, it's more important not passing the password.
But I remain in page1 and, once logged, relative links in page2 are
shown (inside page1) and they will not work.
(Moreover page2 content says that I'm logged but Session variables of
page2 are not set cause I'm on page1 server)
Do you know any other solutions?


Relative links are fixable (you just need to insert the full URLs into the
links in the HTML returned from the API call before sending the browser).
However, there is no way around the session handling - as the client browser
won't send the session identifier to your page so that you can send it in
the API call, your only solution is to use the client side scripted post
with hidden form fields.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,244
Members
46,839
Latest member
MartinaBur

Latest Threads

Top