views:

338

answers:

1

How can I iterate over the headers in the sys.net.webrequest object. The documentation says it is a dictionary, but there seems not to be an easy way to iterate over the dictionary.

A: 

Without knowing what this sys.net.webrequest thing is (I'm not an ASP.Net Ajax guy), here's how you'd iterate over a dictionary anyway.

var headers = MyWebRequest.get_headers();
for(var key in headers) {
    if(headers.hasOwnProperty(key) {
        // here key is the name of the header, and headers[key] is it's value
    }
}
Rakesh Pai
I know that, and am using dictionaries all the time in C#. But this JavaScript thingie is somewhat different
Rine