views:

32

answers:

2

Hello,

Here's the scenario. My page loads with certain objects in the session. The user clicks a button, 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

A: 

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

JoshBerke
+1  A: 

all you do is set (EnableSession = true) on your webmethod attribute.

Yep, in C# it looks like this: [WebMethod(EnableSession = true)]
apathetic