Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate http post request from controller

Tags:

Forgive me if this is a stupid question. I am not very experienced with Web programming. I am implementing the payment component of my .net mvc application. The component interacts with an external payment service. The payment service accepts http post request in the following form

http://somepaymentservice.com/pay.do?MerchantID=xxx&Price=xxx&otherparameters

I know this is dead easy to do by adding a form in View. However, I do not want my views to deal with third party parameters. I would like my view to submit information to my controller, then controller generates the required url and then send out the request. Following is the pseudo code.

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult PayForOrder(OrderForm order)
{
    var url = _paymentService.GetUrlFromOrder(order);
    SendPostRequest(url);
    return View("FinishedPayment");
}  

Is it possible to do so? Does c# have built-in library to generate http request? Thanks in advance.