C# 4.0 防止将https更改为http
我有一段使用RestSharp的v130的非常简单的代码。代码本身编译得很好,并从服务器返回值——问题是它们不是我想要的 代码 有两件事很明显,@已更改为%40,这应该会导致问题,而http已更改为httpsC# 4.0 防止将https更改为http,c#-4.0,restsharp,C# 4.0,Restsharp,我有一段使用RestSharp的v130的非常简单的代码。代码本身编译得很好,并从服务器返回值——问题是它们不是我想要的 代码 有两件事很明显,@已更改为%40,这应该会导致问题,而http已更改为https 可以告诉restsharp不要从https和http转换吗?你的标题毫无意义。是将https更改为http,还是将http更改为https?您的描述说http已更改为https,但查看您的代码,我不太确定。抱歉,它正在从https更改为http private void startTest
可以告诉restsharp不要从https和http转换吗?你的标题毫无意义。是将https更改为http,还是将http更改为https?您的描述说http已更改为https,但查看您的代码,我不太确定。抱歉,它正在从https更改为http
private void startTest()
{
string email = "bob2@example.com";
string password = "password";
doRestSharpWebRequest(email, password);
}
private void doRestSharpWebRequest(email, password)
{
var restClient = new RestClient();
restClient.BaseUrl = "https://mytestserver.com/api";
restClient.Authenticator = new SimpleAuthenticator("email", email, "password", password);
var restRequest = new RestRequest("token", Method.GET);
restRequest.AddHeader("Accepts", "application/json;version=1");
restRequest.AddHeader("Authorization", "apikey zyzyz");
restRequest.RequestFormat = DataFormat.Json;
IRestResponse<userlogin> response = restClient.Execute<userlogin>(restRequest);
}
Message = No HTTP resource was found that matches the request URI 'http://mytestserver.com/api/token?Email=bob%40example.com&password=password'.