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.WebRequestManager defaultExecutor Property

Gets or sets the default network executor type that is used to make network requests.

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.

Syntax

var dExecutor = Sys.WebRequestManager.get_defaultExecutorType ();
Sys.Net.WebRequestManager.set_defaultExecutorType(value);

Parameter

Description

value

A reference to an implementation of the WebRequestExecutor class.

Exceptions

Exception Type Condition

ArgumentException

An invalid parameter was passed.

Return Value

The object that represents the default Web request executor.

Remarks

Use the defaultExecutor property to get or set the default executor that is a reference to the current WebRequestExecutor object.

When the WebRequestExecutor object is ready to send a Web request to the executor, it uses the request executor you supplied. If you do not supply an executor, the WebRequestExecutor creates an instance of the XmlHttpExecutor class.

Example

The following example shows how to get and set the default executor by using the defaultExecutorType property. This code is part of a complete example found in the WebRequestManager class overview.

JavaScript

// Gets and sets the default executor.
function DefaultExecutor()
{
    // Clear the previous results. 
    resultElement.innerHTML = "";

    // Get system default executor type.
    var sysDefaultExecutor = 
        Sys.Net.WebRequestManager.get_defaultExecutorType();
    alert("Get default executor:" + sysDefaultExecutor);


    // Modify the default executor type.
    Sys.Net.WebRequestManager.set_defaultExecutorType(
    "Sys.Net.CustomExecutor");

    var customDefaultExecutor = 
        Sys.Net.WebRequestManager.get_defaultExecutorType();

    alert("Set default executor: " + customDefaultExecutor);

    // Set the executor back to the system default. This is 
    // to allow the WebRequest script to run.
    executor = "Sys.Net.XMLHttpExecutor";
    Sys.Net.WebRequestManager.set_defaultExecutorType(
    sysDefaultExecutor);    

}