I have to integrate a C# web application (App1, a shopping cart) with another C# web application (App2 - a checkout page) that integrates with a payment service (PaymentApp).
- Neither App2 or PaymentApp can be changed.
- App2 must receive data and at least one file via a POST request.
- PaymentApp only accepts POSTs from App2.
So, I add a button in App1 to make it post to App2 like this...
<asp:Button ID="Button1" runat="server" PostBackUrl="App2" onclick="Button1_Click"/>
But when I do that Button1_Click (which contains server side pre-submission processing) never gets called. Note: server side processing can't be transferred to the client side, that's why it's on the server!
So, how can I POST both data and files to App2 and still get my Button1_Click event in App1 (or some other event in App1) to execute prior to the POST taking place?
I've read countless posts about using HttpWebRequest, WebClient, Server.Transfer, StringBuilder etc. but none of the examples fit this scenario. I'm beginning to think it can't be done but that's too defeatist. With the combined knowledge and widsom of StackOverflow this must be possible.