How do I redirect using POST

D

davidfahy

Hi all

How can I transfer user to another server using POST. The problem is
that
Server.Transfer (preserves form data) works just in current server.
Response.Redirect - uses GET method. However I have to open a remote
server
page using POST method. Using HttpWebRequest class is not good
solution, as I can post to and read data from remote server, but user
browser itselft is still connected to my
server.

Thanks in Advance
 
B

bruce barker \(sqlwork.com\)

you have to do it in client script. render a html form with an auto post.

<form name=mypost action="othersite.com" method=post>
<input type=hidden name=field1 value="value1">
<input type=hidden name=field2 value="value2">
</form>
<script>document.forms["mypost"].submit();</script>


-- bruce (sqlwork.com)
 
P

Peter Morris [Droopy eyes software]

Would returning the HTTP response for "Permanently moved" do it?
 
E

Erik Funkenbusch

How can I transfer user to another server using POST.

If you're using .NET 2.0, then you can set the URL to post to in the button
properties. If you're using .NET 1.1, then you have to do it through some
client side script.
 
V

vMike

Hi all

How can I transfer user to another server using POST. The problem is
that
Server.Transfer (preserves form data) works just in current server.
Response.Redirect - uses GET method. However I have to open a remote
server
page using POST method. Using HttpWebRequest class is not good
solution, as I can post to and read data from remote server, but user
browser itselft is still connected to my
server.

Thanks in Advance

If you are using 2.0 you can look into PostBackURL for buttons and images
and linkbuttons
 
Joined
Jul 1, 2009
Messages
1
Reaction score
0
Hi,

Did you have any luck with this? I need to do the same thing but I also need to pass variables to the URL being called (which is an external ecommerce payment gateway). I also can't use an HttpWebRequest object for doing this as the page needs to display, not just load and return the results.

If I use something like this in my form:

<form id="form1" method="post" runat="server">

<asp:HiddenField id="EPS_MERCHANT" value="ACB1234" runat="server" />
<asp:HiddenField id="EPS_PASSWORD" value="FUH5F8JHD9" runat="server" />

<asp:Button ID="btnSubmit" PostBackURL="https://<website>/post/authorise" text="Submit Payment" runat="server" />
<form>

it will redirect to the site but not pass any of the parameters.

I'm using .Net 2.0 - surely thre is way to do this without using WebRequest?

Could the fact none of the parameters in my page posts have anything to do with the target site being a secure one?

Cheers,

Mike
 
Last edited:

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

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top