Can I connect to a Azure SQL database from ASP.NET application hosted in IONOS

Cristopher Aguilera 91 Reputation points
2021-11-22T09:36:57.333+00:00

Good morning,

I have a Web Forms application currently hosted in IONOS which connects to a SQL database within IONOS as well. I have now created a new database within the Azure platform and I would like to connect to my SQL database (in azure) from my IONOS app. Is this possible?

Thanks in advance!

Kind regards,
Cris

Azure SQL Database
{count} votes

1 answer

Sort by: Most helpful
  1. Alberto Morillo 34,671 Reputation points MVP Volunteer Moderator
    2021-11-22T13:18:21.623+00:00

    Based on this IONOS article you can connect to a SQL Server database using System.Data.SqlClient. The following example shows a connection string for SQL Database using System.Data.SqlClient.

    <add name="ConnectionStringName"
        providerName="System.Data.SqlClient"
        connectionString="Data Source=tcp:ServerName.database.windows.net,1433;Initial Catalog=DatabaseName;Integrated Security=False;User Id=username@servername;Password=password;Encrypt=True;TrustServerCertificate=False;MultipleActiveResultSets=True" />
    

    The TrustServerCertificate=False setting is recommended to help protect against man-in-the-middle attacks.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.