1
web.configの接続文字列の暗号化機能に問題があります。web.configの暗号化された接続文字列でエラーが発生する
暗号化は完全に機能します。しかし、暗号化が有効になるとすぐに私はセッション変数の内容を失う(セッション変数のNull例外)。
web.configで接続文字列の暗号化を無効にすると、すべて正常に戻ります。
#region Constructeur
static QueryManager()
{
Configuration config = WebConfigurationManager.OpenWebConfiguration("~");
ConnectionStringsSection section = config.GetSection("connectionStrings") as
ConnectionStringsSection;
if (section.SectionInformation.IsProtected)
{
section.SectionInformation.UnprotectSection();
config.Save(ConfigurationSaveMode.Minimal);
}
if ((myConnectionString =
ConfigurationManager.ConnectionStrings["DBConnect"].ConnectionString) == null)
{
throw new ConfigurationErrorsException("Database server not configured");
}
section.SectionInformation.ProtectSection("DataProtectionConfigurationProvider");
config.Save(ConfigurationSaveMode.Minimal);
}
#endregion
あなたの助けのおかげ百万:
は、ここで接続文字列の暗号化のための私のコードです!
私のコードは、このWebサイトに基づいています。http://msdn.microsoft.com/en-us/library/89211k9b%28v=vs.80%29.aspx –