get/post in a generic handler
-
19-04-2021 - |
Question
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
which of these two is get and which is post? It is used in a generic handler (.ashx file).
Solution
[WebMethod]
[ScriptMethod(UseHttpGet = true/false, ResponseFormat = ResponseFormat.Json)]
public bool UseHttpGet { set; get; }
Member of System.Web.Script.Services.ScriptMethodAttribute
Summary: Gets or sets a value that indicates whether to invoke the method by using HTTP GET.
Returns: 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.
we can make both get and post methods
OTHER TIPS
ScriptMethod allows you to call the method in Get scenarios. Which otherwise need to be called via POST
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow