Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to POST data to external URL in MVC4 using server side

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

like image 654
whoah Avatar asked Jan 13 '14 21:01

whoah


1 Answers

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

like image 187
fejesjoco Avatar answered Oct 06 '22 23:10

fejesjoco