2

I am trying to access the delicious API and decided to start using the RestSharp library for the calls. My test code looks like this:

var client = new RestClient("https://api.del.icio.us/");
client.Authenticator = new HttpBasicAuthenticator("username", "password");            
client.UserAgent = "my_user_agent";            
var request = new RestRequest("v1/tags/get");

client.ExecuteAsync(request, response =>
{
   if (response.ResponseStatus == ResponseStatus.Error)
   {
      Dispatcher.BeginInvoke(() =>
      {
          MessageBox.Show(response.ErrorMessage);
      });
   }
   else if (response.ResponseStatus == ResponseStatus.Completed)
   {                    
      Dispatcher.BeginInvoke(() =>
      {
          MessageBox.Show(response.Content);
      });
   }
});

For this code the delicious API returns "access denied" code although my username and password used in the code are correct. I suspect that I may be doing something wrong with RestSharp as I just started using this library. Can anyone help me with the code above? What am I doing wrong?

4

1 回答 1

0

您可能必须使用

client.Credentials = new NetworkCredential("username", "password");

查看 标准 curl,例如从 dotnet 访问

至于为什么在地球上你不会像世界上任何其他系统一样允许访问..不要问我..

于 2013-04-16T19:57:23.543 回答