创建监听器在asp.net中的http post请求mvc 4

问题描述:

我必须从interfax API接收'回调'。当interfax上的用户(拥有账户)接收到传真时,它会通过指定的URL向账户持有人发送回电,该URL必须能够接收Http Post请求。 指导在这里Accepting incoming fax notifications by callback创建监听器在asp.net中的http post请求mvc 4

我创建了一个控制器和行动“指数”为

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(); 
} 

当我在国际文传电讯帐户接收传真,我得到再打我的网络服务器。 但问题是我没有获取数据。我得到每个变量null或空。 我是否使用正确的方式接收来自任何客户端API的http post请求?

据我了解,国际文传社向您的申请发送邮寄申请。 因为它的一个POST请求,你应该能够读取贴值Request["phoneNumber"]

How to retrieve form values from HTTPPOST, dictionary or?

+0

感谢@adt, 它解决了我的问题。 不同之处在于,Request.QueryString [“id”],Request [“id”]为我工作。 – Lali