Search code examples
asp.netasp.net-ajaxasp.net-session

Is it possible to share session state between asp.net aspx page making a call to an asp.net webservice


My Situation:

I have 1 asp.net application with both aspx pages AND webservices

I make calls (using ajax) to the webservice from an aspx page - all within the same asp.net application!

Here is my problem/question Is there any way to share the session state?

I.e. - the aspx page has a sessionID and the state is being maintained. When the call to the webservice is made, is there a way to automatically send the seesionID to the webservice and then be able to access the same session state from the webservice?

--

That would greatly simplify my work! :) Many thanks for your ideas!!


Solution

  • You should add the EnableSession property to the WebMethod attribute on your web service methods:

    [WebMethod(EnableSession=true)]