Organizational Research By

Surprising Reserch Topic

curl request with asp net

curl request with asp net  using -',curl,web,httpwebrequest'

I have read some other posts on Stack but I can't get this to work. It works fine on my when I run the curl command in git on my windows machine but when I convert it to it's not working:

 private void BeeBoleRequest()
        string url = "";

        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();

This is the BeeBole API. Its pretty straight fwd. but I am getting a following 500 error when I run the above:

The remote server returned an error: (500) Internal Server Error.

asked Oct 11, 2015 by patelnikul321
0 votes

Related Hot Questions

1 Answer

0 votes
answered Oct 11, 2015 by sameer rathore