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

Gets or sets the HTTP verb that was used by the Sys.Net.WebRequest class to issue the Web request.

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 verb = MyWebRequest.get_httpVerb();
MyWebRequest.set_httpVerb(value);

Parameter

Description

value

A string that contains the HTTP verb for the Web request. value must be an HTTP verb that is recognized by the Web server, such as "GET" or "POST".

Return Value

The current Web request verb.

Exceptions

Exception Type Condition

Sys.ArgumentException

value cannot be null or an empty string ("").

Remarks

If the HTTP verb has not been previously set, the httpVerb property value is determined based on the following logic:

  • If the value of the body property is null, the WebRequest instance returns "GET".

  • If the value of the body property is not null, the WebRequest instance returns "POST". If the returned body is an empty string (""), this is considered not null and "POST" is returned.

Example

The following example shows how to set the HTTP verb for the Web request. This code is part of a complete example found in the WebRequest class overview.

javascript

// Set the request verb.
wRequest.set_httpVerb("POST");