Tôi có thể sử dụng các giá trị phiên bên trong a WebMethod
không?
Tôi đã thử sử dụng System.Web.Services.WebMethod(EnableSession = true)
nhưng tôi không thể truy cập thông số Phiên như trong ví dụ này :
[System.Web.Services.WebMethod(EnableSession = true)]
[System.Web.Script.Services.ScriptMethod()]
public static String checaItem(String id)
{
return "zeta";
}
đây là JS gọi webmethod:
$.ajax({
type: "POST",
url: 'Catalogo.aspx/checaItem',
data: "{ id : 'teste' }",
contentType: 'application/json; charset=utf-8',
success: function (data) {
alert(data);
}
});