【发布时间】:2012-01-25 00:44:17
【问题描述】:
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
这两个哪个是get,哪个是post? 它用于通用处理程序(.ashx 文件)。
【问题讨论】:
标签: asp.net post get generic-handler
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
这两个哪个是get,哪个是post? 它用于通用处理程序(.ashx 文件)。
【问题讨论】:
标签: asp.net post get generic-handler
ScriptMethod 允许您在 Get 场景中调用方法。否则需要通过 POST 调用
【讨论】:
[WebMethod]
[ScriptMethod(UseHttpGet = true/false, ResponseFormat = ResponseFormat.Json)]
public bool UseHttpGet { set; get; }
Member of System.Web.Script.Services.ScriptMethodAttribute
总结: 获取或设置一个值,该值指示是否使用 HTTP GET 调用方法。
返回: 如果使用 HTTP GET 命令调用该方法,则为 true;如果使用 HTTP POST 命令调用该方法,则为 false。默认为假。
我们可以同时创建 get 和 post 方法
【讨论】: