我正在尝试验证 Braintree's webhook notifications 的端点。他们向我发送了一个 GET
请求,其中包含一个我需要在其函数之一中使用的参数。
我想我应该发回一个 POST
请求,但不确定正确的实现。相当于 MVC 的 return Content()
的 Web 表单是什么?
public class WebhooksController : Controller
{
public ActionResult Accept()
{
return Content(Constants.Gateway.WebhookNotification.Verify(Request.QueryString["bt_challenge"]));
}
}
最佳答案
不确定这是否是最好的方法,但你可以制作 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; }
}
}
关于c# - WebForms 相当于 MVC 的 "return Content()"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24977322/