I have a list of objects that I store in a session. This list is then displayed on the web page with a small βXβ next to each item. When one of them is clicked, I use Javascript to remove the item from the list on the page, and then I send an AJAX call to the server to remove the item from the list in the session. Here, where things get a little more complicated. I am using ScriptMethod, which looks like this (C #):
[System.Web.Services.WebMethod, System.Web.Script.Services.ScriptMethod]
public static void removeListItem(string itemNumber)
The problem is that this is a static method , which means that I do not have access to the page variable, which in turn means that I do not have access to the session. Now, the sessionID is sent with a request (which I also canβt access), and the server has a session, so I would suggest that there is a way to accept this identifier and access the session. Is there a way to access the session from a static method like this? Thank!
Peter source
share