2021-01-28 18:54:43 +01:00
|
|
|
include::../description.adoc[]
|
|
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
|
|
|
|
----
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
|
|
{
|
|
|
|
optionsBuilder.UseSqlServer("Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password="); // Noncompliant
|
|
|
|
}
|
|
|
|
----
|
|
|
|
|
2021-02-02 04:09:31 +00:00
|
|
|
In https://docs.microsoft.com/en-us/troubleshoot/aspnet/create-web-config[Web.config]
|
|
|
|
|
|
|
|
----
|
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
<configuration>
|
|
|
|
<connectionStrings>
|
|
|
|
<add name="myConnection" connectionString="Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=" /> <!-- Noncompliant -->
|
|
|
|
</connectionStrings>
|
|
|
|
</configuration>
|
|
|
|
----
|
|
|
|
|
2021-01-28 18:54:43 +01:00
|
|
|
== Compliant Solution
|
|
|
|
|
|
|
|
----
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
|
|
{
|
|
|
|
optionsBuilder.UseSqlServer("Server=myServerAddress;Database=myDataBase;Integrated Security=True");
|
|
|
|
}
|
|
|
|
----
|
|
|
|
|
2021-02-02 04:09:31 +00:00
|
|
|
In https://docs.microsoft.com/en-us/troubleshoot/aspnet/create-web-config[Web.config]
|
|
|
|
|
|
|
|
----
|
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
<configuration>
|
|
|
|
<connectionStrings>
|
|
|
|
<add name="myConnection" connectionString="Server=myServerAddress;Database=myDataBase;Integrated Security=True" />
|
|
|
|
</connectionStrings>
|
|
|
|
</configuration>
|
|
|
|
----
|
|
|
|
|
2021-01-28 18:54:43 +01:00
|
|
|
include::../see.adoc[]
|