|
using System;
using System.Collections.Specialized;
using System.Configuration;
namespace IssueVisionWebWseCS
{
// stores shared settings (like the database connection string)
public class Common
{
private readonly static string m_connString;
private readonly static bool m_usePlainTextDbCxnString;
// database connection string
public static string ConnectionString
{
get
{
return m_connString;
}
}
// initializes common settings
static Common()
{
// initialize the database connection string
m_usePlainTextDbCxnString = Convert.ToBoolean(ConfigurationSettings.AppSettings["sqlConn.UsePlainText"]);
if (m_usePlainTextDbCxnString)
{
m_connString = ConfigurationSettings.AppSettings["sqlConn.ConnectionString.PlainText"];
}
else
{
string cxnStringCipherText = ConfigurationSettings.AppSettings["sqlConn.ConnectionString.Protected"];
m_connString = DataProtection.Decrypt(cxnStringCipherText, DataProtection.Store.Machine);
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
Weidong has been an information system professional since 1990. He has a Master's degree in Computer Science, and is currently a MCSD .NET