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.



public bool UseHttpGet { get; set; }


Public Property UseHttpGet As Boolean


bool UseHttpGet {
	bool get ();
	void set (bool value);


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


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.


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.


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.


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


<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)