Sys.Net.XmlHttpExecutor.getAllResponseHeaders Method

Returns all the response headers.

Note

To get or set property values for client API properties, you must call property accessor methods that are named with the get_ and set_ prefixes. For example, to get or set a value for a property such as cancel, you call the get_cancel or set_cancel methods.

var statusText = MyExecutor.getAllResponseHeader();

Exceptions

Exception type

Condition

Sys.InvalidOperationException

The getAllResponseHeaders property was accessed outside the event handler.

-or-

The getAllResponseHeaders property was accessed after the completed event occurred.

Remarks

If the request completed successfully, the getAllResponseHeader method returns a string that contains all the response headers. If the request is not successful, an error is returned instead.

You can call the getAllResponseHeaders method only in code that is running inside a completed event handler, or running in the call stack of the completed event handler. An exception is thrown if you call the getAllResponseHeaders method when the executor did not return successfully, or if the XmlHttpExecutor.responseAvailable property returns false. An exception is also thrown if you call the getAllResponseHeaders method after the completed event has occurred. This is because the executor has released releases its reference to the browser's XMLHTTP object.

Example

The following example shows how to get all the headers. This code is part of a complete example found in the Sys.Net.XmlHttpExecutor class overview.

// Get all the headers.    
resultElementId.innerHTML += 
"All Request Headers: " +
    executor.getAllResponseHeaders() + "<br/>"; 

See Also

Reference

Sys.Net.WebRequestManager Class

Sys.Net.WebRequestExecutor Class

Sys.Net.XMLHttpExecutor Class