views:

33

answers:

1

i have created a web service that will we accessible to only authenticated user of the website.when user first time call a web method first he will we authenticated.when authentication is successfull i will create a session for that user.now on next call to the web service by that user i want to use that session means he is authenticated user.But on the next call session becomes null .what is the problem with that.

How to retain the value of the session in web service ? please suggest a way to do that?

+1  A: 

You need to set the WebMethodAttribute.EnableSession property to true to have access to session, like this:

[WebMethod(EnableSession = true)]
public string HelloWorld() {
  return "Hello World!";
}
Nick Craver
i have set it true what it does not work when i call the web service from another application next time
Lock up
session become null on next call
Lock up
@Lock - You're calling this method from a *separate* web application?
Nick Craver
yes i am calling from another application
Lock up
@Lock - Session is unique to an application, it won't be shared between then, what are you trying to do here?
Nick Craver
i am using session in the same application dear.what between different soap call and it lost its avalue
Lock up
Either i have to set the sessionSatate property in web config gile? for session to work
Lock up