Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 在mvc中获取api发送的属性_Asp.net_Asp.net Mvc_Asp.net Mvc 3 - Fatal编程技术网

Asp.net 在mvc中获取api发送的属性

Asp.net 在mvc中获取api发送的属性,asp.net,asp.net-mvc,asp.net-mvc-3,Asp.net,Asp.net Mvc,Asp.net Mvc 3,我正在使用paytab的API。paytab是一种支付网关api。 付款后,它将返回到我的操作结果页面。在那里,我需要获取Payment\u reference属性,paytab使用POST方法发送该属性。 在asp.net两层中,我这样做,并为我工作 public partial class TheReturnPage : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) {

我正在使用paytab的API。paytab是一种支付网关api。 付款后,它将返回到我的操作结果页面。在那里,我需要获取Payment\u reference属性,paytab使用POST方法发送该属性。 在asp.net两层中,我这样做,并为我工作

 public partial class TheReturnPage : System.Web.UI.Page
{

    protected void Page_Load(object sender, EventArgs e)
    {
        HttpContext c = HttpContext.Current;
        if (c.Request["payment_reference"] != null)
        {

            string paymentReference = c.Request["payment_reference"].ToString();
            if (VerifyPayment(paymentReference))
            {
                //Payment is verified and logging out from payment process
                if (LogoutPayment())
                {
                    TextBox1.Text = "Payment is verified and logged out successfuly";
如何在MVC中实现同样的功能?
您可以在这里找到paytab手册

您可以使用控制器中的Request.Form对象,该对象包含请求的POST值,如下所示:

string paymentReference = Request.Form.Get("payment_reference");