We have a requirement where we would like to redirect the user to a login page when ASP.NET Session expires and the user is working in a Silverlight plugin.
So, scenario is, we have a legacy application which runs ASP.Net, all our new modules are in Silverlight, and the legacy app loads the Silverlight application. That all works :-) The user then walks away from their desk and comes back after the ASP.Net Session times out, but then tries to carry on doing something in the Silverlight App, which uses a RIA Domain Service. Because the session has time out, the RIA Domain Service fails, but it does not fail with a SessionExpired exception, nor with a User/Password invalid, it just fails with a Domain Exception which is similar to "real" exceptions thrown in the domain model so we have no way of identifying that this time it was because the session expired.
There are plenty answers for how to keep your ASP.Net session alive, we dont want to do that, we want the session to expire, but we want to be able to handle it gracefully in Silverlight and direct the user to the login page.
We have this working, but the problem is whenever an exception is raised in the Silverlight application, this redirects you to the login page, which is not the intended behaviour. We only want to redirect when it is a case of the session expiring.
Any ideas?