【发布时间】:2009-08-05 08:28:57
【问题描述】:
我正在通过 Jquery 在我的 ASP.NET 应用程序中对页面方法进行 AJAX 调用。
$.ajax({
type: "POST",
url: "APage.aspx/GetDropDowns",
data: "{'AId':'1'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
alert(msg.d);
},
error: function() {
alert('Error ');
}
[System.Web.Services.WebMethod]
public static string GetDropDowns(string Id)
{
return "Id was: " + Id;
}
我记得在使用 ASP.NET AJAX 时,鼓励使用 Web 服务而不是页面方法。但是,如果我像上面那样执行 JSON 并做一个帖子 A)上述任何安全漏洞和B)使用网络服务而不是页面方法的任何理由
【问题讨论】: