8

Simple question:

Now I have that form in my view:

<form action="https://www.xyz.com/xyz/ISO/NewPayment"
method="post" name="payform">

    <input type="hidden" name="session_id" value="@Model.OrderId">
    <input type="submit" value="Pay">
</form>

It send POST data and redirect user to https://www.xyz.com/xyz/ISO/NewPayment.

So simple, but I want to check on server side correctness of that data, before user will be redirected to a external URL.

How can I do this in asp.net MVC? How can I send POST data from server side, and then redirect user?

Regards

whoah
  • 4,363
  • 10
  • 51
  • 81

1 Answers1

2

Use the WebClient or HttpWebRequest on the server side to POST data. This works in any .net code, not just mvc.

fejesjoco
  • 11,763
  • 3
  • 35
  • 65
  • could you give me an example, how can I use it in controller, where I have to return ActionResult? Regards – whoah Jan 14 '14 at 08:04
  • 1
    @fejesjoco I know this is old question/answer, but the example provided doesn't redirect the user to the external url/page afterward? – Sum NL May 23 '17 at 06:47