Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi all,
Vanilla are planning an update to the site on April 24th (next Wednesday). It is a major PHP8 update which is expected to boost performance across the site. The site will be down from 7pm and it is expected to take about an hour to complete. We appreciate your patience during the update.
Thanks all.

.NET button postBackUrl problem

Options
  • 25-04-2007 11:46am
    #1
    Registered Users Posts: 4,044 ✭✭✭


    I'm using the postBackUrl property of a .NET 2.0 button to post off my order form to a payment gateway. All seemed well until i tried hooking up my order processing code. It appears that the click event of the button isn't firing server side. I haven't been able to find any documentation that conclusively states whether or not server side events should fire when using postBackUrl but I've seen a couple of comments that suggest they should.

    So firstly I'd like if someone could tell me for sure whether or not they're supposed to fire. If not can anyone think of an alternative way of processing my order before posting off to the payment gateway? (without adding another step to the order process)


Comments

  • Registered Users Posts: 7,394 ✭✭✭Trampas


    Would you not to the post url in the server side code under the button instead of in the property


  • Registered Users Posts: 4,044 ✭✭✭muckwarrior


    Trampas wrote:
    Would you not to the post url in the server side code under the button instead of in the property
    You mean programmatically POST to the Url instead? I thought of that but I don't think there's any easy way to do that in .Net (correct me if I'm wrong). Obviously Response.redirect won't work and neither will Server.Transfer as it's outside the application.


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    You can't capture the click event on cross page postbacks. Could you use a Server.Transfer?


  • Registered Users Posts: 4,044 ✭✭✭muckwarrior


    Evil Phil wrote:
    You can't capture the click event on cross page postbacks. Could you use a Server.Transfer?
    Cheers, thats what I wanted to know. AFAIK Server.Transfer only works within the scope of the application, so I cant use it to post to a third party site.


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    Sorry, I forgot it was off site.


  • Advertisement
  • Registered Users Posts: 7,394 ✭✭✭Trampas


    Response.redirect will post you out


  • Registered Users Posts: 4,044 ✭✭✭muckwarrior


    Trampas wrote:
    Response.redirect will post you out
    No, response.redirect will just redirect the client. It cant send POST data which I need it to do.


  • Registered Users Posts: 7,394 ✭✭✭Trampas


    Can you not attched it to the url


  • Registered Users Posts: 4,044 ✭✭✭muckwarrior


    No, the destination page will only accept data via POST. If I could use GET there'd be no problem at all.


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    Could you use a standard HTML form within your page to do the post for you?


  • Advertisement
  • Registered Users Posts: 4,044 ✭✭✭muckwarrior


    I dont think so. I have to do some processing with the order server side before the form is posted off. I could split it up into two pages but thats what I'm trying to avoid.


  • Registered Users Posts: 4,044 ✭✭✭muckwarrior


    Solution was actually very simple in the end. In my server side click event I just write this to the page.
    <script type="text/javascript">
            document.forms[0].action = "https://www.mypaymentgateway.com";
            document.forms[0].submit();
    </script>
    


Advertisement