【问题标题】:WebForms equivalent of MVC's "return Content()"?WebForms 相当于 MVC 的“return Content()”?
【发布时间】:2014-07-27 02:22:04
【问题描述】:

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

【问题讨论】:

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


    【解决方案1】:

    不确定这是否是最好的方法,但您可以创建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; }
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-01-13
      • 1970-01-01
      • 2011-10-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多