views:

71

answers:

1

Hi,

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.

A: 

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:

  1. http://blogs.silverlight.net/blogs/msnow/archive/2008/07/16/tip-of-the-day-19-using-isolated-storage.aspx
  2. 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

Aaron Hoffman