Using Session in Silverlight using simple WebServices (NOT WCF)
I need to use Session variables in my Silverlight application ( Using Visual Studio 2008, and Silverlight 3). I am already using a webservice (not WCF service) and would like to know if 开发者_开发百科I can add two methods say GetSessionVariable and SetSessionVariable in my existing WebService Class?
Any assistance with sample code would be great!
Regards and Thanks in advance, Nadeem.
Where should these values persist? Are they only needed in the Silverlight Client or also on the Server?
If they are only needed within the Silverlight Client in the browser, you can use Silverlight's Isolated Storage:
- http://blogs.silverlight.net/blogs/msnow/archive/2008/07/16/tip-of-the-day-19-using-isolated-storage.aspx
- http://msdn.microsoft.com/en-us/library/system.io.isolatedstorage%28VS.95%29.aspx
If that does not work, you can just add the two methods to your web service and update the service reference (proxy) in your Silverlight project: http://support.microsoft.com/kb/308359
精彩评论