[ACCEPTED]-How to read HTTP header from response using .NET HttpWebRequest API?-httpwebresponse

Accepted answer
Score: 12

You should simple be able to use:

using (WebResponse response = request.GetResponse())
  string limit = response.Headers["X-RateLimit-Limit"];

If that 2 doesn't work as expected, you can do a watch 1 on response.Headers and see what's in there.

Score: 2

Look at the raw response text (e.g., with 7 Fiddler). If the header isn't there, no 6 amount of C# code is going to make it appear. :) From 5 what you've shown, it seems the header isn't 4 in the response.

Update: When I go to: http://twitter.com/account/rate_limit_status.xml there 3 is no X-RateLimit-Limit header. But when I go to http://twitter.com/statuses/public_timeline.xml, it's there. So 2 I think you just need to use a different 1 method.

It still says 150, though!

More Related questions