Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Webmatrix/Razor-问题返回正文_C#_Asp.net_Razor_Webmatrix_Braintree - Fatal编程技术网

C# Webmatrix/Razor-问题返回正文

C# Webmatrix/Razor-问题返回正文,c#,asp.net,razor,webmatrix,braintree,C#,Asp.net,Razor,Webmatrix,Braintree,我正在尝试为webhook响应编写一个快速页面。该方法需要获取查询字符串参数,并在主体中传回响应。这是我到目前为止所拥有的 @using System; @using System.Collections.Generic; @using Braintree; @using System.Diagnostics; @{ Layout = "~/template"; //Initialise Braintree Server SDK BraintreeGateway gat

我正在尝试为webhook响应编写一个快速页面。该方法需要获取查询字符串参数,并在主体中传回响应。这是我到目前为止所拥有的

@using System;
@using System.Collections.Generic;
@using Braintree;
@using System.Diagnostics;
@{
    Layout = "~/template";

    //Initialise Braintree Server SDK
    BraintreeGateway gateway = new BraintreeGateway
    {
        Environment = Braintree.Environment.SANDBOX,
        PublicKey = "xxx",
        PrivateKey = "xxx",
        MerchantId = "xxx"
    };

    return gateway.WebhookNotification.Verify(Request.QueryString["bt_challenge"]);

}
问题是,当我运行此页面时,会收到以下错误消息:

由于“ASP.\u Page\u Payments\u Webhook\u cshtml.Execute()”返回void,因此return关键字后面不能跟对象表达式


虽然我不熟悉您尝试执行的所有操作,但我认为cshtml页面不应该返回任何内容,因此警告是这样的。所以,除了最后两行代码外,请完全按照您的代码进行尝试。取下回流管,改为:

@using System;
@using System.Collections.Generic;
@using Braintree;
@using System.Diagnostics;
@{
    Layout = "~/template";

    //Initialise Braintree Server SDK
    BraintreeGateway gateway = new BraintreeGateway
    {
        Environment = Braintree.Environment.SANDBOX,
        PublicKey = "xxx",
        PrivateKey = "xxx",
        MerchantId = "xxx"
    };


}

@gateway.WebhookNotification.Verify(Request.QueryString["bt_challenge"]);