Search code examples
asp.netpostgetgeneric-handler

get/post in a generic handler


[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