-
will the session of the ASP.NET page hosting the Silverlight plugin expire/timeout when no work/interaction is done on the Silverlight plugin?
-
if ASP.NET session timeout is say 20 minutes and the user continues interaction with the Silverlight plugin for forty minutes, will the ASP.NET session timeout or not?
note:
by session, i am referring to the session variables used in my WCFservice and on the ASP.NET host page,
The answer is simply yes, it will timeout.
You should see the Silverlight application as a javascript app, or as any desktop app. If you don’t explicitely perform interactions with your ASP.NET app during the execution of the SL App, ASP.NET won’t know that your user is active: ASP.NET is only able to refresh sessions on HTTP request.
But you can maintain the session from the Silverlight App by sending requests to your website (aka keepalive requests, or something more useful, it depends on your requirements)
Use the browser stack to send the cookies to ASP.NET with your request using the WebClient class in Silverlight. A javascript timer and jquery could do the trick too, if you don’t want to perform this logic from your SL App (therefore keeping it free from these considerations)
Keep Alive with Silverlight
The browser network stack is enabled by default on Silverlight, therefore if you didn’t change anything, your app will use it.
If you only want to implement a keep alive for your session, add to your site an URL processed by ASP.NET (an aspx file, or a route, an handler… depending on your web site implementation (for instance /KeepAlive.aspx ))
in your silverlight application, use this code to add a timer to the application. It will perform a web request through the WebClient class every X minutes.
The code should be called after application startup (for instance in the App.xaml.cs file)
Keep Alive with JS (JQuery)
In your SL hosting page, use JQuery to perform the same get request on the server, every X minutes from page load.