WebForms相当于MVC的“返回内容()”?

时间:2014-07-27 02:22:04

标签: c# asp.net asp.net-mvc webforms braintree

我正在尝试验证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"]));
  }
}

1 个答案:

答案 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; }
    }
}