How can I catch a System.ServiceModel.Security.SecurityAccessDeniedException

Please take a look at the following code from the Translation Memory API:

var server = new TranslationProviderServer(uri, false, INVALIDUSERNAME, pswd); // Does not throw
server.GetTranslationMemories(TranslationMemoryProperties.All) // Throws System.ServiceModel.Security.SecurityAccessDeniedException

1)  Right now, the API does not throw any exception on the first line with an invalid user name.
 I think the API should thrown an exception with invalid credentials.

2) The second line, DOES throw an exception, but I cannot seem to catch it.

Is there a way to catch this type of exception?

Parents Reply Children