title: Web response in C# .NET doesn't work more than a couple of times
body: <p>I am developing an application using twitter api and that involves writing a method to check if a user exists. Here is my code:</p>
  
  <pre><code>  public static bool checkUserExists(string user)
      {
          //string URL = "https://twitter.com/" + user.Trim();
          //string URL = "http://api.twitter.com/1/users/show.xml?screen_name=" + user.Trim();
          //string URL = "http://google.com/#hl=en&amp;sclient=psy-ab&amp;q=" + user.Trim();
          string URL = "http://api.twitter.com/1/users/show.json?screen_name=" + user.Trim();
          HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(URL);
          try
          {
              var webResponse = (HttpWebResponse)webRequest.GetResponse();
              return true;
          }
          //this part onwards does not matter
          catch (WebException ex)
          {
              if (ex.Status == WebExceptionStatus.ProtocolError &amp;&amp; ex.Response != null)
              {
                  var resp = (HttpWebResponse)ex.Response;
                  if (resp.StatusCode == HttpStatusCode.NotFound)
                  {
                      return false;
                  }
                  else
                  {
                      throw new Exception("Unknown level 1 Exception", ex);
                  }
              }
              else
              {
                  throw new Exception("Unknown level 2 Exception", ex);
              }
          }
      }
  </code></pre>
  
  <p>The problem is, calling the method does not work(it doesn't get a response) more than 2 or 3 times, using any of the urls that have been commented, including the google search query(I thought it might be due to twitter API limit). On debug, it shows that it's stuck at:</p>
  
  <pre><code>var webResponse = (HttpWebResponse)webRequest.GetResponse();
  </code></pre>
  
  <p>Here's how I am calling it:</p>
  
  <pre><code>Console.WriteLine(TwitterFollowers.checkUserExists("handle1"));
  Console.WriteLine(TwitterFollowers.checkUserExists("handle2"));
  Console.WriteLine(TwitterFollowers.checkUserExists("handle3"));
  Console.WriteLine(TwitterFollowers.checkUserExists("handle4"));
  Console.WriteLine(TwitterFollowers.checkUserExists("handle5"));
  Console.WriteLine(TwitterFollowers.checkUserExists("handle6"));
  </code></pre>
  
  <p>At most I get 2-3 lines of output. Could someone please point out what's wrong?</p>
  
  <p><strong>Update 1:</strong><br>
  I sent 1 request every 15 seconds (well within limit) and it still causes an error. on the other hand, sending a request, closing the app and running it again works very well (on average accounts to 1 request every 5 seconds). The rate limit is 150 calls per hour <a href="https://dev.twitter.com/docs/rate-limiting#rest" rel="nofollow">Twitter FAQ</a>.</p>
  
  <p>Also, I did wait for a while, and got this exception at level 2:
  <a href="http://pastie.org/3897499" rel="nofollow">http://pastie.org/3897499</a></p>
  
  <p><strong>Update 2:</strong>
  Might sound surprising but if I run fiddler, it works perfectly. Regardless of whether I target this process or not!</p>