Documentation for: ASP.NET Ajax Version 1.0

This documentation is for a previous version. For the current released version, see the ASP.NET Ajax documentation on MSDN.








Sys.Net.XmlHttpExecutor responseData Property

Gets the text representation of the response body.


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 responseData = MyExecutor.get_responseData();


Exception Type Condition


The responseData property was accessed outside the event handler.


The responseData property was accessed after the completed event occurred.

Return Value

The text representation of the response body, if there is one; otherwise, an empty string ("").


If the Web request completed successfully, you can get the value of the responseData property to get the text representation of the response body. If there is no response body, this property returns an empty string ("").

The executor does not attempt any character conversions on the response data. Instead, it relies on the browser's XMLHTTP implementation for Unicode conversion behavior. For Microsoft Internet Explorer, the response is returned as UTF-8 text unless the server has included a byte order marker (BOM) at the start of the response to indicate a different variation of Unicode.

You can use the responseData property 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 use the responseDataproperty when the executor did not return valid response data, or if the response is not yet available (if the responseAvailable property returns false). An exception is also thrown if you use the responseDataproperty after the completed event has occurred. This is because the executor has released its reference to the browser's XMLHTTP object.


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


// Display Web request body.
resultElementId.innerHTML += "Body: <br/>";
resultElementId.innerText +=