title: How to handle exceptions on WCF Custom Authentication?
body: <p>I have a WCF service configured to use custom UserName validation via the overridden Validate() method of the System. <code>IdentityModel.Selectors</code>. <code>UserNamePasswordValidator</code> class.</p>
  
  <p>When the validation fails, I throw a <code>SecurityTokenValidationException</code>. </p>
  
  <p>The way it was built, in my client, I'm receiving a <code>CommuinicationException</code> with the message: The remote server returned an error: NotFound.</p>
  
  <p>What's the best way to handle this exception in the client side?</p>
  
  <p>My validation code:</p>
  
  <pre><code>if (user == null || (Environment.TickCount - user.LastCall) &gt; 300000)
  {
      if (!LoginUser.ValidateUser(userName, password))
      {
          throw new SecurityTokenValidationException("Usuário/Senha inválido");
      }
  }
  </code></pre>