How to share the web application session with a webservice
Here's the scenario. My page loads with certain objects in the session. The user clicks a butt开发者_开发问答on, and I need to update a certain section of my page using jquery. The jquery would make an ajax call to the web service which needs to access one of the objects in the session. How would I do this? How can my web service access the current session object?
update: I'm using asmx
all you do is set (EnableSession = true) on your webmethod attribute.
If your building a WCF service you can set this attribute on the class:
[AspNetCompatibilityRequirements
(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
Which should give you access. If your using asmx I don't remeber off the top of my head
精彩评论