C# / ASP.NET - how to transfer user to, and post data to, a url at the same time??

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • manwood
    New Member
    • Feb 2008
    • 2

    #1

    C# / ASP.NET - how to transfer user to, and post data to, a url at the same time??

    Hi all

    I am trying to insert an order into my database, post some data to a third party payment system and redirect the user to the third party payment page all in the same method.

    I can write to the database ok, I can post the data to the payment URL ok, but i cant redirect the user in the same action.

    I have tried Server.Transfer Request but im getting a PlatformNotSupp orted exception (my host is running IIS6). I have also tried using a basic html form (which works) but doesnt allow me to execute additional code in the .cs file (to insert into the database and do thoer things).

    I would really appreciate any suggestions as to how i can do this.

    For reference, this is the code in my form button click event. I need something similar that works on IIS6 / .NET 2.0:

    **used php formatting for clarity only***

    [PHP]protected void Btn_Purchase(ob ject sender, EventArgs e)
    {
    //insert order into database
    Order o = (Order)Session["order"];
    Customer c = (Customer)Sessi on["customer"];
    onlinepayments. OrderDAC.Insert Order(o, c);

    //create post data for payment site
    NameValueCollec tion nv = new NameValueCollec tion(3);
    nv.Add("epdqdat a", encryptedData);
    nv.Add("returnu rl", "http://www.mysite.com" );
    nv.Add("merchan tdisplayname", "MySite");

    //transfer user and post data
    Server.Transfer Request("https://secure2.epdq.co .uk/cgi-bin/CcxBarclaysEpdq EncTool.e", true, "POST", nv);
    } [/PHP]


    thanks in advance for any help...

    :)
Working...