【问题标题】:Getting the property send by api in mvc在 mvc 中获取通过 api 发送的属性
【发布时间】:2015-06-13 15:37:31
【问题描述】:

我正在使用 paytab 的 API。 (paytab 是一种支付网关方式 api)。 付款后,它将返回到我的操作结果 TheReturnPage()。在那里,我需要获取 paytab 使用 POST 方法发送的 payement_refrence 属性。 在 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 手册。 https://www.paytabs.com/PayTabs-API%20Documentation.pdf

【问题讨论】:

    标签: asp.net asp.net-mvc asp.net-mvc-3


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-27
      • 1970-01-01
      • 1970-01-01
      • 2012-09-28
      • 2022-01-14
      • 2015-08-28
      相关资源
      最近更新 更多