title: Webresponce Denial of Service
body: <p>I am using this code:-</p>
  
  <pre><code>    WebRequest webrequest = WebRequest.Create("myurl");
      webrequest.Method = "GET";
      webrequest.ContentType = "application/json";
      webrequest.ContentLength = 0;
      using (WebResponse jsonResponse = webrequest.GetResponse())
       {
        using (StreamReader reader = new StreamReader(jsonResponse.GetResponseStream()))
         {
             result = reader.ReadToEnd();                            
         }
      }
  </code></pre>
  
  <p>if an attacker inject large amount of data my system will hang/crass on this line <code>result = reader.ReadToEnd();</code> as this will take large amount of memory &amp; time.</p>
  
  <p>My question is is there anyway to protect this code from attacker. </p>