是否可以在WebMethod
(http://msdn.microsoft.com/en-us/library/byxd99hx(v=vs.90%29.aspx)? )中使用会话值
我尝试过使用System.Web.Services.WebMethod(EnableSession = true)
,但无法像in this example那样访问会话参数
[System.Web.Services.WebMethod(EnableSession = true)]
[System.Web.Script.Services.ScriptMethod()]
public static String checaItem(String id)
{
return "zeta";
}
下面是调用webmethod的JS:
$.ajax({
type: "POST",
url: 'Catalogo.aspx/checaItem',
data: "{ id : 'teste' }",
contentType: 'application/json; charset=utf-8',
success: function (data) {
alert(data);
}
});
https://stackoverflow.com/questions/4758575
复制相似问题