【发布时间】:2015-03-14 01:36:35
【问题描述】:
我整晚都在尝试在 c# 中获得以下 REST 响应。网址是
http://domain/WebServices/api/AdvisingApi/Authenticate?flashlineID=jdister1&password=password
我使用了一个名为 https://www.hurl.it/ 的站点来确保该端点正在运行,它可以让我得到预期的响应。但是,在我的 C# 代码中,我不断得到一个
"{\"消息\":\"发生错误。\"}"
作为我 RestSharp 请求中的响应。以下是相关代码:
var client = new RestClient("http://domain/WebServices/api/AdvisingApi/");
var request = new RestRequest("Authenticate", Method.POST);
request.RequestFormat = DataFormat.Json;
request.AddParameter("flashlineID", userName);
request.AddParameter("password", password);
IRestResponse response = client.Execute(request);
我不确定自己做错了什么,因为我以与 Hurl.it 发送的相同方式(我认为)构建请求。有什么建议么?谢谢!!
【问题讨论】: