How do I setup my connection string so that communication with the SQL server is encrypted?

Programming, error messages and sample code > sample code

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 web.config 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=tcp:sql1001.smarterasp.net;Initial Catalog=DB_XXX_db1;User ID=DB1_user;Password=*****; encrypt=true;TrustServerCertificate=True" providerName="System.Data.SqlClient"/> 
</connectionStrings>