1
I have this form
@using (Html.BeginForm("PacoteAdd", "Pacote"))
{
<input type="hidden" name="email_cobranca" value="*****@hotmail.com" />
<input type="hidden" name="tipo" value="CBR" />
<input type="hidden" name="moeda" value="BRL" />
<input type="hidden" name="item_id" value="@item.PacoteID" />
<input type="hidden" name="item_descr" value="@item.Titulo" />
<input type="hidden" name="item_quant" value="1" />
<input type="hidden" name="item_valor" value="@item.valor" />
<input type="image" name="submit" src="https://p.simg.uol.com.br/out/pagseguro/i/botoes/pagamentos/99x61-comprar-assina.gif"
alt="Pague com PagSeguro - é rápido, grátis e seguro!" />
}
and this code in the controller
[HttpPost]
public void PacoteAdd(FormCollection fomr)
{
string email_cobranca = Request.Form["email_cobranca"];
string tipo = Request.Form["tipo"];
string moeda = Request.Form["moeda"];
string item_id = Request.Form["item_id"];
string item_descr = Request.Form["item_descr"];
string item_quant = Request.Form["item_quant"];
string item_valor = Request.Form["item_valor"];
}
and would need to send this form on the link
https://sandbox.pagseguro.uol.com.br/checkout/checkout.jhtml
because the original code of the button would be this below
<form target="pagseguro" method="post" action="https://sandbox.pagseguro.uol.com.br/checkout/checkout.jhtml">
<input type="hidden" name="email_cobranca" value="*****@hotmail.com" />
<input type="hidden" name="tipo" value="CBR" />
<input type="hidden" name="moeda" value="BRL" />
<input type="hidden" name="item_id" value="@item.PacoteID" />
<input type="hidden" name="item_descr" value="@item.Titulo" />
<input type="hidden" name="item_quant" value="1" />
<input type="hidden" name="item_valor" value="@item.valor" />
<input type="image" name="submit" src="https://p.simg.uol.com.br/out/pagseguro/i/botoes/pagamentos/99x61-comprar-assina.gif" alt="Pague com PagSeguro - é rápido, grátis e seguro!" />
</form>
what you should use to send?
i need the form to be sent from the controller, because I need to perform an action on the controller before sending the form.
– Fabio Souza
see the answer, edited with in example how you can make the request in the controller
– Ricardo Pontual