views:

424

answers:

1

I need to be able to use WCF Session capability in a Silverlight application. Currently Silverlight only supports basicHttp binding, so this is impossible. My thoughts are to create a middle piece with wsHttp caapabilities that will handle the Sessions for me and my sessionless Silverlight app can pass in the SessionID guid.

Is this even possible? If so, how would it be implemented?

+1  A: 

Nicholas Allen just blogged about something similar to this: http://blogs.msdn.com/drnick/archive/2008/10/08/working-with-session-state.aspx

Do you mean Session as in "ASP.NET"-like session? If that's the case (and your using an HTTP based binding and hosting in IIS) you can run your service in ASP.NET compatability mode.

The other thing he mentions, which might keep your WCF service more in the realm of acting like a WCF service is to create a custom behavior based on the IInstanceContextProvider. There are few moving parts: you'll have to save your Session to non-volatile storage and put a session identifier in the message header to match them up on the service side (use can use a message contract for that) BUT it perserves some of the WCFness of your service.

Good luck!

James Bender