Skip to content

Commit a517404

Browse files
Merge pull request #10484 from ghogen/connection-strings-oct22
update for VS 2022
2 parents a184cf1 + 3e7c9ef commit a517404

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

docs/data-tools/how-to-save-and-edit-connection-strings.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: 'How to: Save and Edit Connection Strings'
33
description: Know how to save and edit connection strings in Visual Studio applications. Save or edit a connection string directly in application settings.
44
ms.custom: SEO-VS-2020
5-
ms.date: 11/04/2016
5+
ms.date: 10/07/2022
66
ms.topic: how-to
77
ms.assetid: f8ef3a2c-029c-423b-9d9e-a4f1add4f640
88
author: ghogen
@@ -15,11 +15,18 @@ ms.workload:
1515
# How to: Save and edit connection strings
1616

1717
[!INCLUDE [Visual Studio](~/includes/applies-to-version/vs-windows-only.md)]
18-
Connection strings in Visual Studio applications are saved in the application configuration file (also referred to as application settings), or hard-coded directly in your application. Saving connection strings in the application configuration file simplifies the task of maintaining your application. If the connection string needs to be changed, you can update it in the application settings file (as opposed to having to change it in the source code and recompile the application).
1918

20-
Storing sensitive information (such as the password) within the connection string can affect the security of your application. Connection strings saved to the application configuration file are not encrypted or obfuscated, so it may be possible for someone to access the file and view its contents. Using Windows integrated security is a more secure way to control access to a database.
19+
> [!NOTE]
20+
> This article provides guidance for handling connection strings in Windows applications; for cloud and web applications, more secure techniques are available. You can use [Connected Services](../azure/overview-connected-services.md) to add support for Secrets.json for local development, and then migrate to Azure Key Vault for secrets storage when you deploy to Azure. See [Protect secrets during development.](/aspnet/core/security/app-secrets?tabs=windows).
21+
22+
Properly handling the connection string in a Visual Studio application requires care to avoid presenting security risks. Connection strings in Visual Studio applications are often saved in the application configuration file (also referred to as application settings), or hard-coded directly in your application. Hard-coding directly into the application is not recommended, because the sensitive information in the connection string, such as the database credentials, can be read directly from the unencrypted binaries. Saving connection strings in the application configuration file simplifies the task of maintaining your application. If the connection string needs to be changed, you can update it in the application settings file (as opposed to having to change it in the source code and recompile the application).
23+
24+
Storing sensitive information (such as the password) within the connection string can affect the security of your application. Connection strings saved to the application configuration file are not encrypted or obfuscated, so it may be possible for someone to access the file and view its contents.
25+
26+
For databases that support it, using Windows integrated security is a more secure way to control access to a database.
2127

2228
If you do not choose to use Windows integrated security and your database requires a user name and password, you can omit them from the connection string, but your application will need to provide this information to successfully connect to the database. For example, you can create a dialog box that prompts the user for this information and dynamically builds the connection string at run time. Security can still be an issue if the information is intercepted on the way to the database.
29+
2330
For more information, see [Protecting connection information](/dotnet/framework/data/adonet/protecting-connection-information).
2431

2532
## To save a connection string from within the Data Source Configuration Wizard

0 commit comments

Comments
 (0)