开发者

Redirect Silverlight To Login Page On Session Timeout

I have a silverlight app that uses a simple Login.aspx page. I have all the basic ASP.NET config and it works great for page requests when sessions expire or are missing. But the silverlight service requests are not page requests, they are looking for application/msbin serialized data. So when these requests arrive for an expired session, they are redirected to the login pa开发者_如何学运维ge, which they follow and eventually end up swallowing HTML content (the login page markup). Of course that ends with a content/parsing error, as I would expect.

So my question is, what must I do to have the silverlight service responses somehow redirect the browser when the server finds the session has expired.

I've written this by hand in Javascript before and had to have the ajax response handler detect a custom header so it could do a document.location = newPath. Something along those lines would be nice.

Also, I'm not interested in other solutions I've read for keeping the session alive with no-op pings, and I would prefer not to have to implement timers and custom session manager inside the client. Hoping I've missed a setting somewhere.


I had exactly the same problem. Unfortunately it is not a simple setting. I documented a possible solution here. After session timeout a call of the RIA services returns a DomainServiceException which will be handled in the central Unhandled_Exception handler. If the user is not authenticated I just redirect to the main page.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜