![](/img/trans.png)
[英]How to manipulate with multi collection in MongoDB when we using ASP.NET API Core2.1
[英]How to Post Encrypted request to external URL in asp.net core2.1
我有一个现有的 asp.net 应用程序并尝试将其迁移到 netcoreapp2.1 (MVC)。 以下代码发布到 asp.net 应用程序中的外部 URL
if (DisplayType.SelectedValue == "1")
{
Form.Action = txt_payment_gateway_url.Text;
}
else if (DisplayType.SelectedValue == "2")
{
RedirectionURL.Value = txt_payment_gateway_url.Text;
}
在 asp.net 核心应用程序中,我使用此代码将加密请求发布到外部应用程序
var result = PostEncryptedData(data, VM.PaymentGatewayURL);
private async Task<HttpResponseMessage> PostEncryptedData1(Dictionary<string, string> encryptedData, string url)
{
HttpClient client = new HttpClient();
List<KeyValuePair<string, string>> keyValuePairs = encryptedData.ToList();
var content = new FormUrlEncodedContent(keyValuePairs);
content.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded");
return await client.PostAsync(url, content);
}
但是在调试期间,它给了我结果未计算结果未计算结果
它必须是var result = await PostEncryptedData(data, VM.PaymentGatewayURL);
. 你错过了await
Public async Task<your required return type> YourMethodName()
{
var result = await PostEncryptedData(data, VM.PaymentGatewayURL);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.