CDR API .Net Call


#1

Hi,
I need to call the CDR API from a .Net application but i can’t find any documentation on how to build the authentication header.
I tried basic authentication in browser and it works perfectly but when i make the same call from the .Net app the authentication fails.

Basic Authentication URL : https://username:password@xxx.xxx.xxx.xxx:8443/cdrapi?format=CSV

.Net Code

try
{

Uri uri = new Uri("https://username:password@xxx.xxx.xxx.xxx:8443/cdrapi?format=CSV");
NetworkCredential credentials = new NetworkCredential("username", "password");
CredentialCache credentialCache = new CredentialCache();
credentialCache.Add(new Uri(@"https://xxx.xxx.xxx.xxx:8443/"), "Digest", credentials);

HttpWebRequest request = WebRequest.Create(uri) as HttpWebRequest;
request.PreAuthenticate = true;
request.Credentials = credentialCache;

WebResponse response = request.GetResponse();
response.Close();

}
catch (WebException wex) { Debug.WriteLine(wex.Message); }
catch (Exception ex) { Debug.WriteLine(ex.Message); }

Please Help, and **Thanks**