Forms Authentication Timeout

We noticed an issue with our Silverlight application the other day. If the user hadn't invoked any service calls from the Silverlight client to server after a certain period of idle time, then all the service calls would fail. Debugging showed that the services were returning an HTTP request to the client to redirect to the login.aspx page.

After investigation we found that the problem was caused by the forms authentication timing out after a period of inactivity. By default the forms authentication value is set at 30 minutes, and after this time the services are no longer accessible by the client because we marked them to require authentication. The solution was to add a timer to one of our Silverlight classes that repeatedly performs a service call to an empty server method called Ping every 30 seconds to restart the forms authentication timeout timer.