How to set up a connection string so that communication with the SQL server is encrypted

The connection string below is an example that specifies the use of encryption. Essentially you are using the connection string from the SQL section of your control panel and adding encrypt=true to the end. Setting the encrypt property to true will cause the transmission of data to and from the SQL server to be encrypted. 

 

<connectionStrings> <add name="MyConnection" connectionString="Data Source=server;Initial Catalog=database;User ID=username;Password=password; encrypt=true;TrustServerCertificate=true" providerName="System.Data.SqlClient"/> </connectionStrings>