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 Answer 1

7

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";
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.