whoah
whoah

Reputation: 4443

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

Upvotes: 8

Views: 6223

Answers (1)

fejesjoco
fejesjoco

Reputation: 11903

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

Upvotes: 2

Related Questions