Issue with making an encrypted connection to SQL server from your application

Issue
Your application returns the following error when connecting to the SQL server with an encrypted connection from your application (Classic ASP, ASP.NET, .NET Core and PHP).

The certificate chain was issued by an authority that is not trusted.

Cause of Issue
This error happens because we are using a self-signed certificate on our SQL server for encrypted connection.


How to Resolve the Issue

For Classic ASP / ASP.NET / .NET Core applications, update your connection string as follows

"Data Source=DBSERVERNAME;Initial Catalog=YOURDBNAME;User ID=YOURUSERID;Password=YOURPASSWORD;Encrypt=yes;TrustServerCertificate=true"

For PHP applications, modify the database connection information as follows

$connectionInfo = array( "Database"=>"YOURDBNAME", "UID"=>"YOURUSERID", "PWD"=>"YOURPASSWORD","Encrypt"=>true,"TrustServerCertificate"=>true);

Finally, Recycle your application pool within the control panel's Site Tools for the change to take effect.