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.WebRequest Class

Provides client script functionality to make a Web request.

Namespace: Sys.Net

Inherits: None

Syntax

var wRequest = new Sys.Net.WebRequest();

Constructors

Name

Description

webRequest Constructor

Initializes a new instance of the WebRequest class.

Members

Name

Description

add_completed Method

Registers an event handler to associate with the Web request instance.

completed Method

Raises the completed event for the associated Sys.Net.WebRequest instance.

getResolvedUrl Method

Gets the resolved URL of the Web request instance.

invoke Method

Issues a network call for the Web request instance.

remove_completed Method

Removes the event handler associated with the Web request instance.

body Property

Gets or sets the HTTP body of the Web request.

executor Property

Gets or sets the executor of the associated Web request instance.

headers Property

Gets the HTTP headers for the Web request.

httpVerb Property

Gets or sets the Web request HTTP verb used to issue the Web request.

timeout Property

Gets or sets the time-out value for the Web request instance.

url Property

Gets or sets the URL of the Web request instance.

userContext Property

Gets or sets the user context associated with the Web request instance.

Remarks

The WebRequest class is used by asynchronous communication layer classes to make a Web request. You typically do not use this type directly in your applications. Instead, from the browser you call Web service methods or static page methods by using proxy methods. For more information, see Exposing Web Services to Client Script.

However, you can create and use a WebRequest instance for the following scenarios:

  • When you want to make network requests that are not simple Web service method calls.

  • When you want to set HTTP request properties directly.

  • When you are using a custom executor that is based on the Sys.Net.WebRequestExecutor class.

Example

The following example shows how to create an instance of the WebRequest class to make a GET Web request.