string RequestUrl = "http://compudance.net/api/School/GetClasses";
byte[] cred = UTF8Encoding.UTF8.GetBytes("C100349D-455F-4042-A1D7-6C262832C28F:FED5425");
var httpWebRequest = (HttpWebRequest)WebRequest.Create(RequestUrl);
httpWebRequest.ContentType = "application/json";
httpWebRequest.Method = "Get";
httpWebRequest.ContentLength = 0;
httpWebRequest.Headers["Authorization"] = "Basic " + Convert.ToBase64String(cred);
try
{
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
var jsonString = streamReader.ReadToEnd();
streamReader.Close();
var serializer = new JavaScriptSerializer();
var result = serializer.DeserializeObject(jsonString);
}
}
catch (Exception ex)
{
}