Thank you for your quick response. Using the ASP.NET session seems a bit complicated. To clarify, what exactly do you mean by "service class"? Do I have to create a separate class which represents the ASP.NET session? Would this be on the server side or client side code?
Furthermore, regarding the application level variable. I was under the impression that an application level variable would be available to all users running the application online. Therefore a user session would not be unique or secure in this scenario. Is this correct? Or is an application level variable unique to each user that views the Silverlight page on their own machine?
Can you give me an example of an application level variable I could use to store a "user" object, for example?
Finally, I came across another idea of using a static class with a Dictionary to store session data on the client side. See the code below. What do you think of this implementation? And, like the application level variable, will this be unique to each user who is currently running the application, or will they all share the same data in this class at the same time?
Main Topics
Browse All Topics





by: BondinASPPosted on 2008-09-22 at 02:02:00ID: 22538387
There is no support for Session variable in Silverlight.. you can pass some variable from the Silverlight application to the server via a web service. Then in the web service, you store it as a session variable. Later when you call another web service, you can check the session variable and return it to the client.
="true"/>
ements(Req uirementsM ode = AspNetCompatibilityRequire mentsMode. Allowed)]
n["YourNam e"] = something;
n["YourNam e"];
While WCF also has built-in session support, BasicHttpBinding doesn't support that. So you need to use ASP.NET session instead. To enable ASP.NET session on WCF, you need to turn on ASP.NET Compatibility. Do the following:
* In web.config, under system.serviceModel tag, add this line:
<serviceHostingEnvironment aspNetCompatibilityEnabled
* On your service class (not interface), add this attribute:
[AspNetCompatibilityRequir
* Now you can use ASP.NET session with the following syntax:
HttpContext.Current.Sessio
object something = HttpContext.Current.Sessio
That being said, I think in your scenario, it's better to store your object on the client side using isolated storage or an application level variable.