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 defaultTimeout Property

Gets or sets the time-out for the default network executor.

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 dTimeout = Sys.Net.WebRequestManager.get_defaultTimeout ();
Sys.Net.WebRequestManager.set_defaultTimeout(value);

Parameter

Description

value

The time in milliseconds that the default executor should wait before timing out a Web request. This value must be 0 or a positive integer.

Return Value

An integer value that indicates the current time-out for the default executor.

Exceptions

Exception Type Condition

Sys.ArgumentOutOfRangeException

An invalid parameter was passed.

Remarks

Use the defaultTimeout property to get or set the time in milliseconds that the default executor should wait before timing out a Web request.

By setting a time-out value that is not zero, you can make sure that a pending Web request returns the control back to the caller in a timely manner.

Example

The following example shows how to set and get the default executor time-out. This code is part of a complete example found in the WebRequestManager class overview.

JavaScript

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

    // Get system default timeout.
    var sysDefaultTimeout = 
        Sys.Net.WebRequestManager.get_defaultTimeout();

    alert("Get default timeout: " + sysDefaultTimeout);


    // Set custom default timeout.
    Sys.Net.WebRequestManager.set_defaultTimeout(100);

    var customDefaultTimeout = 
        Sys.Net.WebRequestManager.get_defaultTimeout();

    alert("Set default timeout: " + customDefaultTimeout);


    // Set the timeout back to the system default. 
    Sys.Net.WebRequestManager.set_defaultTimeout(
    sysDefaultTimeout);    

}