How can I access session in a webmethod?

You can use:

HttpContext.Current.Session

But it will be null unless you also specify EnableSession=true:

[System.Web.Services.WebMethod(EnableSession = true)]
public static String checaItem(String id)
{ 
    return "zeta";
}

Leave a Comment