title: SIgnalR: How to send exceptions to client on connect?
body: <p>In the hub i want to authenticate the clients based on Connection Header.<br/>
  If the client is not allowed to connect, i want to throw an Exception with the detailed error.<br/>
  But, if i throw an exception on the hub, the client only receives "(500) Internal Server Error"</p>
  
  <pre><code>public override Task OnConnected()
  {
      string clientKey = Context.Headers["clientKey"];
      string version = Context.Headers["version"];
      if (!this.isValid(clientKey, version))
          throw new InvalidOperationException("SIGNALR: Invalid client");
  
      return base.OnConnected();
  }
  </code></pre>
  
  <p>What i have to do to send the exception properly?</p>
  
  <p>Thanks!</p>