ScriptMethodAttribute.UseHttpGet Property
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets a value that indicates whether to invoke the method by using HTTP GET.
public:
property bool UseHttpGet { bool get(); void set(bool value); };
public bool UseHttpGet { get; set; }
member this.UseHttpGet : bool with get, set
Public Property UseHttpGet As Boolean
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
.
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.
You cannot override this property from ECMAScript (JavaScript) on the client. If this property is set to true
, 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. Each input parameter for the method appears as a query parameter in the URL that is used to invoke the Web method. The parameter 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 be used only for operations where no sensitive data is exposed and when the server action does not have side effects.
Important
Setting the UseHttpGet property to true
might pose a security risk for your application if you are working with sensitive data or transactions. In GET requests, the message is encoded by the browser into the URL and is therefore an easier target for tampering.
Product | Versions |
---|---|
.NET Framework | 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: