tags:

views:

34

answers:

1
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 is available on my page as Session["Lang"]. How do I access and send it to the web method?

+1  A: 

You can directly access the session inside the page method:

[WebMethod(EnableSession = true)]
public static string ShowMain()
{
    var lang = HttpContext.Current.Session["Lang"];  
    return "foo";
}
Darin Dimitrov
Thanks Darin. That worked.
Kenyana

related questions