title: How to connect to PostgreSQL from .NET using TLS with both client and server authentication?
body: <p>I want to connect a C# .NET application to a PostgreSQL database, using TLS with client <em>and</em> server authentication: in other words, if the certificate from the client can not be verified against the certificate of the server, the client should get access denied, and if the client can not verify the certificate of the server, the client should immediately abort connecting.</p>
  
  <p>I tried this using Npgsql 1.0, but I can not find any way in Npgsql to specify the client certificate that should be used for the connection.</p>
  
  <p>I did manage to get server certificate verification on the client working, and I also did get all the verification working using the commandline db admin tool psql, but this did not help me further in getting it to work with Npgsql.</p>
  
  <p>So, how would I connect my .NET app using TLS client &amp; server authentication to a PostgreSQL database?</p>
  
  <p>Is there maybe a newer/other data provider that does support this?</p>
  
  <p>Is there actually anyone who did get this to work one way or another?</p>