简体   繁体   English

在ASP.NET MVC 4中创建HTTP发布请求的侦听器

[英]create listener to http post request in asp.net mvc 4

I have to receive 'call back' from interfax API. 我必须从interfax API收到“回叫”。 When a user (having account) on interfax receives a fax, it gives a call back to the account holder on a specified URL that must be able to receive Http Post request. 当interfax上的用户(具有帐户)接收传真时,它将使用必须能够接收Http Post请求的指定URL向帐户持有人回电。 The guidance is here Accepting incoming fax notifications by callback . 此处的指导是通过回调接受传入的传真通知

I created aa controller and action "Index" as 我创建了一个控制器,并将动作“索引”设置为

public string Index()
    {
        try
        {
            Ifax ifax = new Fax();
            ifax.UserId = Convert.ToString(Request.QueryString["userId"]);
            ifax.Id = Convert.ToInt32(Request.QueryString["id"]);
            ---
            ---
            ifax.Save()
         }
}
catch(Exception ex)
{
    //handle exception
}
    //Just saving to db 'true' or 'false', to know if callback receive.
    //SaveFlag();
}

When I receive fax in my interfax account, I get call back on my webserver. 在我的interfax帐户中接收传真时,我会在网络服务器上回电。 But the problem is that I am not getting data. 但是问题是我没有得到数据。 I get every variable null or empty. 我得到每个变量为null或为空。 Am I using a correct way to receive http post request from any client api? 我是否使用正确的方式从任何客户端api接收http发布请求?

As I understand Interfax sends a Post request to your application. 据我了解,Interfax将Post请求发送到您的应用程序。 since its a post request you should be able to read posted values Request["phoneNumber"] 由于它是发布请求,因此您应该能够读取发布的值Request["phoneNumber"]

How to retrieve form values from HTTPPOST, dictionary or? 如何从HTTPPOST,字典或检索表单值?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM