title: How to use HttpWebRequest.Accept?
body: <p>This is the code i used for deleting an entity,</p>
  
  <pre><code>private void Button_Click_1(object sender, RoutedEventArgs e)
  {
  var request = HttpWebRequest.Create(uri) as HttpWebRequest;
  request.Accept = "application/json;odata=verbose";
  request.Method = "DELETE";
  request.BeginGetResponse(new AsyncCallback(GotResponse), request);
  }
  
  private void GotResponse(IAsyncResult asynchronousResult)
  {
      string data;
      HttpWebRequest myrequest = (HttpWebRequest)asynchronousResult.AsyncState;
      using (HttpWebResponse response = (HttpWebResponse)myrequest.EndGetResponse(asynchronousResult))
          {
              System.IO.Stream responseStream = response.GetResponseStream();
              using (var reader = new System.IO.StreamReader(responseStream))
              {
                  data = reader.ReadToEnd();
              }
              responseStream.Close();
          }
          this.Dispatcher.BeginInvoke(() =&gt;
          {
              MessageBox.Show(data);
          });
  }
  </code></pre>
  
  <p>While using the above one, the app crashed while executing the line </p>
  
  <pre><code>using (HttpWebResponse response = (HttpWebResponse)myrequest.EndGetResponse(asynchronousResult))
  </code></pre>
  
  <p>sending crash message as, if proper exception handling is done it would be safe to run.
  But when i removed the line </p>
  
  <pre><code>request.Accept = "application/json;odata=verbose";
  </code></pre>
  
  <p>Everything worked fine.</p>
  
  <p>Can anyone explain me why it happened so?</p>
  
  <p>Additional Info :
  My server response on successful deletion is,</p>
  
  <pre><code>{
   "code":0,
   "message":"Successfully Deleted"
  }
  </code></pre>