Discussion:
Session Management in Web Services
Tewari, Vijay
2002-05-07 15:33:11 UTC
Permalink
In the case of Web Services what is the support for session state
management. I read about the support for session state management in ASP.NET
web apps but was not sure how or if that is applicable to web services.

What I wan to be able to do is to be able to call a web method multiple
times with session state being maintained in between these calls.

Thanks

Regards
Vijay

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.
Rama Krishna
2002-05-07 15:39:48 UTC
Permalink
If you apply the attribute like this,

[WebMethod(EnableSession=true)]
void MyWebMethod();

MyMethod would have session information. Looks at docs for
WebMethodAttribute and EnableSession property

-----Original Message-----
From: Tewari, Vijay [mailto:***@INTEL.COM]
Sent: Tuesday, May 07, 2002 11:33 AM
To: ***@DISCUSS.DEVELOP.COM
Subject: [DOTNET] Session Management in Web Services


In the case of Web Services what is the support for session state
management. I read about the support for session state management in
ASP.NET web apps but was not sure how or if that is applicable to web
services.

What I wan to be able to do is to be able to call a web method multiple
times with session state being maintained in between these calls.

Thanks

Regards
Vijay

You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.
Jeremy Hopkin
2002-05-07 15:40:52 UTC
Permalink
You want to implement either (in your webservice class):
System.Web.SessionState.IReadOnlySessionState
or
System.Web.SessionState.IRequiresSessionState

For readonly or readwrite session state respectively.

Jeremy
Post by Tewari, Vijay
I read about the support for session state management in ASP.NET
web apps but was not sure how or if that is applicable to web services.
What I wan to be able to do is to be able to call a web method multiple
times with session state being maintained in between these calls.
You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.
Bryan Batchelder
2002-05-07 15:40:43 UTC
Permalink
I believe you will need to roll your own session state...

Perhaps your webservice could provide a method for starting a
session/transaction?

Client calls "SessionStart()" webmethod and the web service creates a
GUID, stores it in a database that will be used for session state
storage, and will return the GUID to the calling client.

Every webmethod called subsequently will have to have that GUID as a
parameter.

Then on subsequent calls, the webservice can use the GUID to grab the
session state from the database.

Make sense?

--b

Bryan Batchelder
eBusiness Consultant
ConnectWise, Inc.
813-935-7100 x 425
Post by Rama Krishna
-----Original Message-----
Sent: Tuesday, May 07, 2002 11:33 AM
Subject: [DOTNET] Session Management in Web Services
In the case of Web Services what is the support for session
state management. I read about the support for session state
management in ASP.NET web apps but was not sure how or if
that is applicable to web services.
What I wan to be able to do is to be able to call a web
method multiple times with session state being maintained in
between these calls.
Thanks
Regards
Vijay
You can read messages from the DOTNET archive, unsubscribe
from DOTNET, or subscribe to other DevelopMentor lists at
http://discuss.develop.com.
You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.
Tewari, Vijay
2002-05-07 15:46:10 UTC
Permalink
Thanks Jeremy. I get the idea of how to maintain session on the server. Is
their intrinsic support for session state on the client side, or do we have
to explicitly pass the cookies around?

Regards
Vijay


-----Original Message-----
From: Jeremy Hopkin [mailto:***@UK.EXPERIAN.COM]
Sent: Tuesday, May 07, 2002 8:41 AM
To: ***@DISCUSS.DEVELOP.COM
Subject: Re: [DOTNET] Session Management in Web Services


You want to implement either (in your webservice class):
System.Web.SessionState.IReadOnlySessionState
or
System.Web.SessionState.IRequiresSessionState

For readonly or readwrite session state respectively.

Jeremy
Post by Tewari, Vijay
I read about the support for session state management in ASP.NET
web apps but was not sure how or if that is applicable to web services.
What I wan to be able to do is to be able to call a web method multiple
times with session state being maintained in between these calls.
You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.
Jeremy Hopkin
2002-05-07 15:49:58 UTC
Permalink
Post by Rama Krishna
If you apply the attribute like this,
[WebMethod(EnableSession=true)]
void MyWebMethod();
MyMethod would have session information. Looks at docs for
WebMethodAttribute and EnableSession property
I think Rama is right on that.
IReadOnlySessionState and IRequiresSessionState are for
web handlers (.ashx files and their ilk). And WebServices don't
seem to implement IHttpHandler.

That's what you get for typing before comfirming... :o

Jeremy

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.
Tewari, Vijay
2002-05-07 15:52:49 UTC
Permalink
Yes Rama is right, but my question still stands about client side support.

Thanks Rama.

Regards
Vijay

-----Original Message-----
From: Jeremy Hopkin [mailto:***@UK.EXPERIAN.COM]
Sent: Tuesday, May 07, 2002 8:50 AM
To: ***@DISCUSS.DEVELOP.COM
Subject: Re: [DOTNET] Session Management in Web Services
Post by Rama Krishna
If you apply the attribute like this,
[WebMethod(EnableSession=true)]
void MyWebMethod();
MyMethod would have session information. Looks at docs for
WebMethodAttribute and EnableSession property
I think Rama is right on that.
IReadOnlySessionState and IRequiresSessionState are for
web handlers (.ashx files and their ilk). And WebServices don't
seem to implement IHttpHandler.

That's what you get for typing before comfirming... :o

Jeremy

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.
Jeremy Hopkin
2002-05-07 15:54:53 UTC
Permalink
Post by Tewari, Vijay
I get the idea of how to maintain session on the server. Is
their intrinsic support for session state on the client side, or do we have
to explicitly pass the cookies around?
Its automagic, and you don't have to do anything, although I admit I
haven't tried it with cookies disabled, so I am assuming that works also.
But don't quote me on the cookieless, working...

(But I imagine it will ;-)

Jeremy

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.
Christian Weyer
2002-05-07 16:46:13 UTC
Permalink
For a proxy based client side approach to Web Services you will need to
create a cookie container for the proxy instance.
The client application' proxy uses the HttpClientProtocol classes which
by default do not know about sessions. Therefore you have to enable
cookie management in the client proxy class by adding code like this in
your client application:
myProxyClass.CookieContainer =
new CookieContainer();

It is important to mention that the session is only valid for a single
client proxy instance.
Of course the sample assumes you have configured your Web Service
correctly to maintain session state. You need to set the
[EnableSession=True] property of the WebMethod attribute which should be
included in ASP.NET's session management.

Cheers,
Christian
---------------------------------
.NET XML Web Services Repertory
http://www.xmlwebservices.cc/
---------------------------------
Post by Jeremy Hopkin
Post by Tewari, Vijay
I get the idea of how to maintain session on the server. Is
their intrinsic support for session state on the client side, or do we have
to explicitly pass the cookies around?
Its automagic, and you don't have to do anything, although I admit I
haven't tried it with cookies disabled, so I am assuming that works also.
But don't quote me on the cookieless, working...
(But I imagine it will ;-)
You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.
Continue reading on narkive:
Loading...