我正在尝试验证Braintree's webhook notifications的端点。他们向我发送了GET
请求,其中包含我需要在其中一个函数中使用的参数。
我想我会发回POST
请求,但不确定正确的实现。什么是相当于MVC' return Content()
的网页表单?
public class WebhooksController : Controller
{
public ActionResult Accept()
{
return Content(Constants.Gateway.WebhookNotification.Verify(Request.QueryString["bt_challenge"]));
}
}
答案 0 :(得分:2)
不确定这是否是最佳方式,但您可以制作generic handler。
public class MyHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
// here you have access to context.Request and context.Response
}
public bool IsReusable
{
get { return false; }
}
}