Then use this source code:
ConnectionString = System.Configuration.ConfigurationManager.AppSettings["MySetting"].ToString();
I customized my BasePage with a utility function as follows:
public string getConnectionString(string vConnectionString)
{
System.Configuration.Configuration rootWebConfig = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
System.Configuration.ConnectionStringSettings connString = null;
string connectionString = string.Empty;
if (0 < rootWebConfig.ConnectionStrings.ConnectionStrings.Count)
{
connString =
rootWebConfig.ConnectionStrings.ConnectionStrings[vConnectionString];
if (connString != null)
connectionString = connString.ConnectionString;
}
return connectionString;
}
References: http://forums.asp.net/p/1353594/2770309.aspx
http://msdn.microsoft.com/en-us/library/ms178411(VS.80).aspx
2 comments:
It's difficult to find educated people for this subject, but you sound like you know what you're talking about!
Thanks
Feel free to visit my blog post - windows registry cleaner
My page: windows xp registry cleaner
This is my first time pay a visit at here and i am in fact happy to read all
at single place.
my blog post - Best Registry Cleaner For Windows 7
my web page - best registry cleaners
Post a Comment