public static string GetConnectionStringFromWebConfig()
{
System.Configuration.Configuration cfg =
return cfg.ConnectionStrings.ConnectionStrings[0].ConnectionString;
}
{
System.Configuration.Configuration cfg =
System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~");
//wfp - open web.config located in the root directoryreturn cfg.ConnectionStrings.ConnectionStrings[0].ConnectionString;
}
of course plain old ConfigurationManager can still be used.
No comments:
Post a Comment