开发者

Forms Authentication expiration + Silverlight

I've got a Silverlight application, on which the server-side uses an authentication mode of type "Forms". This a开发者_运维知识库uthentication expires after some time, which is the behavior we want. The server-side is a .svc web service.

Problem is, if I send a request to the Server side after the authentication expires, I get the "The remote server returned an error: NotFound." message. Ideally, I want a way to know that the authentication is expired so that I can handle it in a more elegant way on the client-side.

Has anyone had to deal with a similar problem?

Thank you!


I will assume that you have no control over the called service. If an immediate update on the client side is not required (it doesn't seem like it from your description), you could simply find out the exception that the service returns and wrap that to display however you like.

ResultObject result;
try {
    result = RetrieveDataFromWebService();
} catch (ExceptionThatIsThrownFromWebService exception) {
    DisplayErrorInCustomWayToUser(exception);
}


Out of the box, Silverlight/WCF communication doesn't handle Faults correctly. My first suggestion would be to read
http://msdn.microsoft.com/en-us/library/ee844556(v=VS.95).aspx
Which illustrates how to tell Silverlight to read the SOAP body when there's an error rather than defaulting to the std CommunicationException behavior.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜