You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/connect/ado-net/connection-strings-and-configuration-files.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,7 +76,7 @@ The .NET Framework 2.0 introduced new classes in the <xref:System.Configuration>
76
76
> [!NOTE]
77
77
> The **machine.config** file also contains a **connectionStrings** section, which contains connection strings used by Visual Studio. When retrieving connection strings by provider name from the **app.config** file in a Windows application, the connection strings in **machine.config** get loaded first, and then the entries from **app.config**. Adding **clear** immediately after the **connectionStrings** element removes all inherited references from the data structure in memory, so that only the connection strings defined in the local **app.config** file are considered.
78
78
79
-
### Work with the configuration classes
79
+
### Work with the configuration files
80
80
81
81
Starting with the .NET Framework 2.0, <xref:System.Configuration.ConfigurationManager> is used when working with configuration files on the local computer, replacing the deprecated <xref:System.Configuration.ConfigurationSettings>. <xref:System.Web.Configuration.WebConfigurationManager> is used to work with ASP.NET configuration files. It is designed to work with configuration files on a Web server, and allows programmatic access to configuration file sections such as **system.web**.
82
82
@@ -91,7 +91,7 @@ You can use the <xref:System.Configuration.ConnectionStringSettingsCollection> t
91
91
|<xref:System.Configuration.ConnectionStringSettings.ProviderName%2A>|The fully qualified provider name. Maps to the **providerName** attribute.|
92
92
|<xref:System.Configuration.ConnectionStringSettings.ConnectionString%2A>|The connection string. Maps to the **connectionString** attribute.|
93
93
94
-
### Example: listing all connection strings
94
+
### Example: Listing all connection strings
95
95
96
96
This example iterates through the <xref:System.Configuration.ConnectionStringSettingsCollection> and displays the <xref:System.Configuration.ConnectionStringSettings.Name%2A?displayProperty=nameWithType>, <xref:System.Configuration.ConnectionStringSettings.ProviderName%2A?displayProperty=nameWithType>, and <xref:System.Configuration.ConnectionStringSettings.ConnectionString%2A?displayProperty=nameWithType> properties in the console window.
97
97
@@ -100,13 +100,13 @@ This example iterates through the <xref:System.Configuration.ConnectionStringSet
### Example: retrieving a connection string by name
103
+
### Example: Retrieving a connection string by name
104
104
105
105
This example demonstrates how to retrieve a connection string from a configuration file by specifying its name. The code creates a <xref:System.Configuration.ConnectionStringSettings> object, matching the supplied input parameter to the <xref:System.Configuration.ConfigurationManager.ConnectionStrings%2A> name. If no matching name is found, the function returns `null` (`Nothing` in Visual Basic).
### Example: retrieving a connection string by provider name
109
+
### Example: Retrieving a connection string by provider name
110
110
111
111
This example demonstrates how to retrieve a connection string by specifying the provider name in the format *Microsoft.Data.SqlClient*. The code iterates through the <xref:System.Configuration.ConnectionStringSettingsCollection> and returns the connection string for the first <xref:System.Configuration.ConnectionStringSettings.ProviderName%2A> found. If the provider name is not found, the function returns `null` (`Nothing` in Visual Basic).
112
112
@@ -185,9 +185,9 @@ For more information about securing ASP.NET applications, see [Securing ASP.NET
Copy file name to clipboardExpand all lines: docs/connect/ado-net/connection-strings.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,7 +63,7 @@ All connection strings share the same basic syntax described above. The set of r
63
63
64
64
Typingmistakescancauseerrors. Forexample, `IntegratedSecurity=true` isvalid, but `IntegratedSecurity=true` causesanerror.
65
65
66
-
Connectionstringsconstructedmanuallyatruntimefromunvalidateduserinputarevulnerabletostring-injectionattacksandjeopardizesecurityatthedatasource. Toaddresstheseproblems, the [connectionstringbuilder](connection-string-builders.md) hascreated. Thisconnectionstringbuilderexposesparametersasstronglytypedproperties, andmakeitpossibletovalidatetheconnectionstringbeforeit's sent to the data source.
66
+
Connectionstringsconstructedmanuallyatruntimefrominvalidateduserinputarevulnerabletostring-injectionattacksandjeopardizesecurityatthedatasource. Toaddresstheseproblems, the<xref:Microsoft.Data.SqlClient.SqlConnectionStringBuilder>classhas been created. This [connection string builder](connection-string-builders.md) class exposes parameters as strongly typed properties, and makes it possible to validate the connection string before it's sent to the data source.
67
67
68
68
## In this section
69
69
@@ -79,6 +79,6 @@ Describes how to configure provider-specific connection strings for `SqlClient`.
The process of obtaining a <xref:System.Data.Common.DbProviderFactory> involves passing information about a data provider to the <xref:System.Data.Common.DbProviderFactories> class. Based on this information, the <xref:System.Data.Common.DbProviderFactories.GetFactory%2A> method creates a strongly typed provider factory. For example, to create a <xref:Microsoft.Data.SqlClient.SqlClientFactory>, you can pass `GetFactory` a string with the provider name specified as "**Microsoft.Data.SqlClient**". The other overload of `GetFactory` takes a <xref:System.Data.DataRow>. Once you create the provider factory, you can then use its methods to create additional objects. Some of the methods of a `SqlClientFactory` include <xref:Microsoft.Data.SqlClient.SqlClientFactory.CreateConnection%2A>, <xref:Microsoft.Data.SqlClient.SqlClientFactory.CreateCommand%2A>, and <xref:Microsoft.Data.SqlClient.SqlClientFactory.CreateDataAdapter%2A>.
20
+
The process of obtaining a <xref:System.Data.Common.DbProviderFactory> involves passing information about a data provider to the <xref:System.Data.Common.DbProviderFactories> class. Based on this information, the <xref:System.Data.Common.DbProviderFactories.GetFactory%2A> method creates a strongly typed provider factory. For example, to create a <xref:Microsoft.Data.SqlClient.SqlClientFactory>, you can pass `GetFactory` a string with the provider name specified as "**Microsoft.Data.SqlClient**".
21
+
22
+
The other overload of `GetFactory` takes a <xref:System.Data.DataRow>. Once you create the provider factory, you can then use its methods to create additional objects. Some of the methods of a `SqlClientFactory` include <xref:Microsoft.Data.SqlClient.SqlClientFactory.CreateConnection%2A>, <xref:Microsoft.Data.SqlClient.SqlClientFactory.CreateCommand%2A>, and <xref:Microsoft.Data.SqlClient.SqlClientFactory.CreateDataAdapter%2A>.
21
23
22
24
## Register SqlClientFactory
23
25
@@ -37,7 +39,7 @@ To retrieve the <xref:Microsoft.Data.SqlClient.SqlClientFactory> object by the <
37
39
The **invariant** attribute identifies the underlying data provider. This three-part naming syntax is also used when creating a new factory and for identifying the provider in an application configuration file so that the provider name, along with its associated connection string, can be retrieved at run time.
38
40
39
41
> [!NOTE]
40
-
> Since in .NET core, there is no GAC or global configuration anymore, the <xref:Microsoft.Data.SqlClient.SqlClientFactory> object should be register by <xref:System.Data.Common.DbProviderFactories.RegisterFactory%2A> method in your project first.
42
+
> In .NET core, since there is no GAC or global configuration support, the <xref:Microsoft.Data.SqlClient.SqlClientFactory> object should be registered by calling <xref:System.Data.Common.DbProviderFactories.RegisterFactory%2A> method in the project.
41
43
42
44
The following sample shows how to use the <xref:Microsoft.Data.SqlClient.SqlClientFactory> in a .NET core application.
43
45
@@ -47,5 +49,5 @@ The following sample shows how to use the <xref:Microsoft.Data.SqlClient.SqlClie
47
49
48
50
-[DbProviderFactories](dbproviderfactories.md)
49
51
-[Connection strings](connection-strings.md)
50
-
-[Using the Configuration Classes](/previous-versions/aspnet/ms228063(v=vs.100))
52
+
-[Using the configuration classes](/previous-versions/aspnet/ms228063(v=vs.100))
51
53
-[Microsoft ADO.NET for SQL Server](microsoft-ado-net-sql-server.md)
Copy file name to clipboardExpand all lines: docs/connect/ado-net/populate-dataset-from-dataadapter.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,7 +52,7 @@ Any number of `DataAdapter` objects can be used with a `DataSet`. Each `DataAdap
52
52
53
53
### Example
54
54
55
-
The following code example populates a list of customers from the `Northwind` database on Microsoft SQL Server, and a list of orders from the `Northwind` database stored in Microsoft Access 2000. The filled tables are related with a `DataRelation`, and the list of customers is then displayed with the orders for that customer.
55
+
The following code example populates a list of customers from the `Northwind` database on Microsoft SQL Server, and a list of orders from the `Northwind` database stored in Microsoft Access. The filled tables are related with a `DataRelation`, and the list of customers is then displayed with the orders for that customer.
Copy file name to clipboardExpand all lines: docs/connect/ado-net/protecting-connection-information.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,7 @@ The fixed identity account should be a low-privilege account that has been grant
39
39
40
40
A connection string injection attack can occur when dynamic string concatenation is used to build connection strings based on user input. If the user input is not validated and malicious text or characters not escaped, an attacker can potentially access sensitive data or other resources on the server. To address this problem, Microsoft SqlClient Data Provider for SQL Server introduced new connection string builder class to validate connection string syntax and ensure that additional parameters are not introduced. For more information, see [Connection String Builders](connection-string-builders.md).
41
41
42
-
## Use Persist Security Info=false
42
+
## Use "Persist Security Info=false"
43
43
44
44
The default value for `Persist Security Info` is false; we recommend using this default in all connection strings. Setting `Persist Security Info` to `true` or `yes` allows security-sensitive information, including the user ID and password, to be obtained from a connection after it has been opened. When `Persist Security Info` is set to `false` or `no`, security information is discarded after it is used to open the connection, ensuring that an untrusted source does not have access to security-sensitive information.
0 commit comments