Monday, March 27, 2006

Using ASP.NET Session State in a Web Service

Using ASP.NET Session State in a Web Service

This was a happy discovery. Haven't had a chance to take advantage of it, yet, as most of our focus is on .Net web apps, but we do occasionally use web services, and many of us thought web services were stateless.

2 Comments:

At 8:19 AM, Blogger jstalnaker said...

Don't be mislead... Yes, web services in .NET do support the use of session state, however, that state will only be maintained if the client passes the ASPNET_SESSION cookie with the request headers to your service. So, if your client is an ASP.NET web application or javascript from the browser, you're golden. But, any other type of client that doesn't implement of pass through that cookie will not be able to maintain session state. From my experience (and that's not a lot :) ) it's best to design web services to be stateless. It will allow you to serve many different types of client applications and you don't have the memory overhead of maintaining session state in the worker process.

My two cents (1.30 euro pennies :) ),

J

 
At 8:22 AM, Blogger Unknown said...

Thanks, Jeff. Sadly, as so often happens, the original page linked to in the post is not there any more. Appreciate you filling in some of the details!

 

Post a Comment

<< Home