How do I redirect using POST

Discussion in 'ASP .Net' started by davidfahy@gmail.com, Jun 14, 2006.

  1. Guest

    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
    , Jun 14, 2006
    #1
    1. Advertising

  2. 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)

    <> wrote in message
    news:...
    > 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
    >
    bruce barker \(sqlwork.com\), Jun 14, 2006
    #2
    1. Advertising

  3. Would returning the HTTP response for "Permanently moved" do it?
    Peter Morris [Droopy eyes software], Jun 14, 2006
    #3
  4. On 14 Jun 2006 07:47:22 -0700, wrote:

    > 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.
    Erik Funkenbusch, Jun 14, 2006
    #4
  5. vMike Guest

    <> wrote in message
    news:...
    > 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
    vMike, Jun 14, 2006
    #5
  6. nzmike

    Joined:
    Jul 1, 2009
    Messages:
    1
    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: Jul 1, 2009
    nzmike, Jul 1, 2009
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?VHJveQ==?=

    Response.redirect does not redirect from .aspx page

    =?Utf-8?B?VHJveQ==?=, Oct 18, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    5,220
    Srowe1975
    Oct 15, 2008
  2. Samuel Shulman

    Reponse.Redirect Using the POST Method

    Samuel Shulman, Nov 28, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    530
    Cowboy \(Gregory A. Beamer\)
    Nov 28, 2006
  3. Sal
    Replies:
    1
    Views:
    380
  4. opo

    using redirect with post method

    opo, Jan 15, 2004, in forum: ASP General
    Replies:
    2
    Views:
    121
    Guest
    Jan 15, 2004
  5. Adam
    Replies:
    8
    Views:
    399
Loading...

Share This Page