WebForms equivalent of MVC's "return Content()"

本文关键字:quot return Content equivalent of WebForms MVC | 更新日期: 2023-09-27 18:15:08

我正在尝试验证Braintree的webhook通知的端点。他们正在向我发送一个GET请求,其中包含一个参数,我需要在他们的一个函数中使用。

我想我应该发送一个POST请求回来,但不确定正确的实现。什么是相当于MVC的return Content()的web表单?

public class WebhooksController : Controller
{
  public ActionResult Accept()
  {
    return Content(Constants.Gateway.WebhookNotification.Verify(Request.QueryString["bt_challenge"]));
  }
}

WebForms equivalent of MVC's "return Content()"

不确定这是否是最好的方法,但您可以创建一个通用处理程序。

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