This guide shows you how to add a database connection string to your web.config file in Plesk. Connection strings allow your ASP.NET application to connect to SQL Server or other databases by storing credentials and server information in a central configuration file.

How to Add a Connection String

  1. Step 1: Log in to Plesk

    Access your Plesk control panel with your credentials.

  2. Step 2: Open File Manager

    Choose the Files option to access the File Manager.

  3. Step 3: Navigate to web.config

    Navigate to the httpdocs folder and open the web.config file.

    web.config file location

  4. Step 4: Insert the connection string code

    In the Code Editor window, insert the following code into the <configuration> section:

    <connectionStrings>
      <add name="ConnectionString" 
           connectionString="Data Source=SERVER_IP;Initial Catalog=DBname;User Id=DBuser;Password=DBuser_password;" 
           providerName="System.Data.SqlClient" />
    </connectionStrings>

    Replace SERVER_IP, DBname, DBuser, and DBuser_password with your actual database server IP, database name, username, and password.

  5. Step 5: Save the file

    After making the changes, click the Save button to apply the configuration.