Ho letto alcuni altri post su Stack ma non riesco a farlo funzionare. Funziona benissimo sulla mia quando ho eseguito il comando curl in git sulla mia macchina Windows, ma quando mi converto ad ASP.NET non funziona:curl Richiesta con ASP.NET
private void BeeBoleRequest()
{
string url = "https://mycompany.beebole-apps.com/api";
WebRequest myReq = WebRequest.Create(url);
string username = "e26f3a722f46996d77dd78c5dbe82f15298a6385";
string password = "x";
string usernamePassword = username + ":" + password;
CredentialCache mycache = new CredentialCache();
mycache.Add(new Uri(url), "Basic", new NetworkCredential(username, password));
myReq.Credentials = mycache;
myReq.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(new ASCIIEncoding().GetBytes(usernamePassword)));
WebResponse wr = myReq.GetResponse();
Stream receiveStream = wr.GetResponseStream();
StreamReader reader = new StreamReader(receiveStream, Encoding.UTF8);
string content = reader.ReadToEnd();
Response.Write(content);
}
Questa è l'API BeeBole. E 'piuttosto semplice. http://beebole.com/api ma sto ottenendo il seguente errore 500 quando eseguo quanto sopra:
Il server remoto ha restituito un errore: (500) Errore interno del server.
Grazie. Ha funzionato a meraviglia – Dkong