0

I have a requirement in my Silverlight 5 app hosted in an ASP.NET site with FormAuthentication with 5 min timeout. I have a client requirement that when the session timeout occurs the next user request must be redirected to login.aspx and login again.

Currently I have this in Application_UnhandledException handler:

if (domainException != null && !WebContext.Current.User.IsAuthenticated) {
    e.Handled = true;
    System.Windows.Browser.HtmlPage.Document.Submit(); // redirect to login page
}

Thanks Elio

jv42
  • 8,521
  • 5
  • 40
  • 64
E-Bat
  • 4,792
  • 1
  • 33
  • 58

1 Answers1

0

You can try with - based on Navigate Method

System.Windows.Browser.HtmlPage.Window.Navigate(new Uri("url", UriKind.Absolute));

Link : http://msdn.microsoft.com/fr-fr/library/cc189809(v=vs.95).aspx

Aghilas Yakoub
  • 28,516
  • 5
  • 46
  • 51
  • Thanks Yakoub, that worked well for redirecting the user, but i'm struggling trying to catch timeout. Currently i have this in Application_UnhandledException in App.xaml.cs: var domainException = e.ExceptionObject as System.ServiceModel.DomainServices.Client.DomainOperationException; if (domainException != null && !WebContext.Current.Authentication.User.Identity.IsAuthenticated) { e.Handled = true; System.Windows.Browser.HtmlPage.Window.Navigate(new Uri("login.aspx", UriKind.RelativeOrAbsolute)); } – E-Bat Sep 21 '12 at 12:50
  • I'am happy to help you user1676134 you can get your timeout from config file – Aghilas Yakoub Sep 21 '12 at 15:10
  • I finally get it working the timeout part: http://forums.silverlight.net/p/215349/510305.aspx – E-Bat Sep 21 '12 at 17:25