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.

 

 

 

 

 

 

 

UseHttpGet Property

Gets or sets a value indicating whether to invoke the method by using HTTP GET.

Syntax

CSharp

public bool UseHttpGet { get; set; }

VisualBasic

Public Property UseHttpGet As Boolean

ManagedCPlusPlus

public:
bool UseHttpGet {
	bool get ();
	void set (bool value);
}

JSharp

/** @property */
/** @property */

Value

Return Value

true if the method is invoked by using the HTTP GET command; false if the method is invoked by using the HTTP POST command. The default is false.

Remarks

You cannot override this property from ECMAScript (JavaScript) on the client. For example, if this property is set to true, then invoking the method from script will always use HTTP GET.

When this property is set to true, the client proxy code uses HTTP GET to call the Web service that has a URL in which each input parameter appears as a query parameter with a value. This value is obtained through JavaScript Object Notation (JSON) serialization and URL encoding of the parameter value.

The use of HTTP GET for invoking the Web service method follows the same guidelines for any other Web interaction. HTTP GET should only be used for safe operations, where no sensitive data is exposed and when the server action does not have side effects, in other words, when the server action is idempotent.

Examples

The following example shows how to apply ScriptMethodAttribute to a Web method with the UseHttpGet property set to true. This code example is part of a larger example provided for the ScriptMethodAttribute class.

CS

[WebMethod]
[ScriptMethod(UseHttpGet = true)]
public string EchoStringAndDate(DateTime dt, string s)
{
    return s + ":" + dt.ToString();
}

VB

<WebMethod()> _
<ScriptMethod(UseHttpGet:=True)> _
Public Function EchoStringAndDate(ByVal dt As DateTime, _
ByVal s As String) As String
    Return s + ":" + dt.ToString()
End Function 'EchoStringAndDate

Assembly: System.Web.Extensions (Module: System.Web.Extensions)