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 add_invokingRequest Method

Registers a handler for processing the invoking request event of the WebRequestManager.

Syntax

Sys.Net.WebRequestManager.add_invokingRequest(handler);

Parameter

Description

handler

The function registered to handle the invoking request event.

Return Value

Remarks

Use the add_invokingRequest method to set a function that the WebRequestManager class must call before it routes the Web request to the executor. This event enables you to inspect the Web requests directed to the WebRequestManager. You can use this event to perform the following tasks:

  • Audit outgoing network requests.

  • Intercept Web requests and selectively cancel them.

  • Process Web requests by using custom logic instead of the executor construct. For example, you can set a local storage service to intercept every request and create response data from a local store instead of letting requests flow across the network.

Your event handler must have the following signature:

function OnInvokingRequest(sender, networkRequestEventArgs){} 

The sender parameter is set to the WebRequestManager instance.

Example

The following example shows how to add an event to be issued before the Web request is executed. This code is part of a complete example found in the WebRequestManager class overview.

JavaScript

// Set the handler to call before the Web request
// is executed.
Sys.Net.WebRequestManager.add_invokingRequest(On_InvokingRequest);