0

I am creating a callback page that receives info from a payment gateway and then updates a database. I then want it to 'submit' itself automatically to a 'thank you' page, passing the order number as a hidden field.

I have looked at httpwebrequest, but I can't see with this solution how it will 'post itself' if that's the right way to put it.

Any help on ho to achieve this would be greatly appreciated.

4
  • Why can't the callback page be the thank-you page? Commented Sep 27, 2011 at 10:48
  • 1
    Why not have the callbacked page just redirect to another page that does the thank you, or as blzm mentioned, the callback page can print the thank you. Commented Sep 27, 2011 at 10:51
  • the callback page is called by the payment gateway so it still under it's domain and ssl. Having the second page allows more flexibility. I could redirect, but then I would have to include query string parameters which I'd rather not do. But I'm open to any suggestions! Commented Sep 27, 2011 at 11:04
  • 1
    @ComfortablyNumb, this answer doesn't need query string parameters if you just make a POST form instead of a GET form (which I think it does currently, depending on the browser defaults). Commented Sep 27, 2011 at 11:15

2 Answers 2

3

If the callback page is regular ASP.NET you could do a server-side Response.Redirect or Server.Execute.

If not you can do a client-side post in javascript:

<form action="yourThankYouUrl.aspx">
    <input type="hidden" name="callbackValue" value="yourCallbackValue" />
</form>
<script type="text/javascript">
    document.forms[0].submit();
</script>
Sign up to request clarification or add additional context in comments.

Comments

1

So, why not using that receive page to also show what you need and save the trouble to have one more page?

If you still want to have a 2nd page just to show the result, at the end of the processing you can write:

Session["job-id"] = "12345679";
Response.Redirect("my2ndpage.aspx");

in that 2nd Page, you simply assign the session text to the control you will have

HiddenField1.Value = Session["job-id"].ToString();

1 Comment

The reason for the second page is that it's not under the control of the payment gateway which makes life generally easier. The first page will be basically on a different domain as it's called by the payment gateway (although we host it).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.