function getMainContent(ID, num, lang){
$.ajax({
type: "POST",
url: "WebMethods.aspx/showMain",
data: '{AID: "' + articleID+ '", ANum: "' +num + '"}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: showSuccess,
failure: function(response) {
alert(response);
}
});
lang在我的页面上可用作Session [“Lang”]。 如何访问并将其发送到Web方法?
答案 0 :(得分:7)
您可以直接访问页面方法中的会话:
[WebMethod(EnableSession = true)]
public static string ShowMain()
{
var lang = HttpContext.Current.Session["Lang"];
return "foo";
}