protected void REST_Execute_DELETE(string uri)
{
WebRequest restclient = this.REST_GetClient(uri);
restclient.Method = "DELETE";
try
{
HttpWebResponse response = (HttpWebResponse)restclient.GetResponse();
if ((int)response.StatusCode < 200 || (int)response.StatusCode > 299)
{
throw new Exception("Bad status code: " + response.StatusCode);
}
response.Close();
}
catch (WebException e)
{
HttpWebResponse response = (HttpWebResponse)e.Response;
StreamReader reader = new StreamReader(response.GetResponseStream());
string json = reader.ReadToEnd();
reader.Close();
response.Close();
throw new Exception("REST request for " + uri + " failed with response: " + (int)response.StatusCode + " " + response.StatusDescription + ", the body of the response was: " + json);
}
}