Hi
Another question about Sessions in webservices
I have read, that usin Sessions in a webservice is a bad design?
Lets explain my scenario;
1) Client is a .NET WinForms application(for public libraries)
2) Server - ASP.NET WebServices, SQL
a) Client logs into library - here i must store library ID and other
ID's(patron id aso.) for future use.
When using Sessions is bad idea how and where to store library ID?
When i store it on client side, i must use it in every method when i call a
webservice!
For example i have method GetAllLoans()
When libray ID is stored serve side, i can only call GetAllLoans() and i get
back dataset.
When library ID is stored on client side, i muse call GetAllLoans(libID)
Also, i think, when ID is stored server side, its much easyer to build other
business logic and queryes
where those ID's are needed!?
Hope you understand me :)
Best regards;
Mex
John Saunders [MVP] - 24 Sep 2007 21:31 GMT
> Hi
>
[quoted text clipped - 15 lines]
> get back dataset.
> When library ID is stored on client side, i muse call GetAllLoans(libID)
Soap Headers are useful for this sort of thing. The client won't have to
physically send the ids on every request; .NET will do it for the client.
Similarly, the server won't have to do anything to access the data in the
headers. It will just sort of "be there".
It's best if a web service is kept stateless. That way, it scales better,
and you don't have to depend on the hosting environment maintaining state
for you (or not).

Signature
--------------------------------------------------------------------------------
John Saunders | MVP - Windows Server System - Connected System Developer
Spam Catcher - 25 Sep 2007 16:34 GMT
> Also, i think, when ID is stored server side, its much easyer to build
> other business logic and queryes
> where those ID's are needed!?
If you need a stateful service, consider using WCF? WCF has session support
built in.