Entity Framework
パスワードを使用してデータベースの SQLServer 接続を作成するために使用しています。
connectionString="DataSource=|DataDirectory|DB.sdf;Password=abc
Entity Framework の使用中にパスワードを保護するにはどうすればよいですか?
Entity Framework
パスワードを使用してデータベースの SQLServer 接続を作成するために使用しています。
connectionString="DataSource=|DataDirectory|DB.sdf;Password=abc
Entity Framework の使用中にパスワードを保護するにはどうすればよいですか?
ConnectionStringsSection oSection = Configuration.ServiceConfiguration.GetConnectionStrings();
if(!oSection.SectionInformation.IsLocked && !oSection.SectionInformation.IsProtected)
{
oSection.SectionInformation.ProtectSection("RSAProtectedConfigurationProvider");
oSection.CurrentConfiguration.Save();
}
EncDecHelper.Decrypt
ここからのサンプルを使用して書くことができます: .NETの文字列の暗号化/復号化
ここから関連情報を見つけることができます:App.configでパスワードを暗号化する
サーバーにアクセスできる場合は、cmd から Web 構成暗号化ツールを使用できます。以下を含む web.config と同じフォルダーに .bat ファイルを作成します。
aspnet_regiis -pef connectionStrings .
aspnet_regiis -pef appSettings .
pause
これにより、connectionStrings セクション全体が暗号化され、私の場合は appSettings セクション全体も暗号化されます。
復号化するには、次のようにします。
aspnet_regiis -pdf connectionStrings .
aspnet_regiis -pdf appSettings .
pause
ただし、これをサーバーから実行する必要があります。