asp.net の C# コードから WebConfigurationManager を使用して、カスタム構成ファイル (abc.config など) から接続文字列を読み取るにはどうすればよいですか?
Configuration conf = WebConfigurationManager.OpenWebConfiguration("~/abc.config");
これはうまくいかないようです。
asp.net の C# コードから WebConfigurationManager を使用して、カスタム構成ファイル (abc.config など) から接続文字列を読み取るにはどうすればよいですか?
Configuration conf = WebConfigurationManager.OpenWebConfiguration("~/abc.config");
これはうまくいかないようです。
webconfigurationmanager で読めるとは思えません。それはxmlファイルであるため、他のxmlファイルと同じように読むことができます
public static string GetSingleValue(string strXPathExpression, string strAttributeName)
{
XmlNode node = GetNode(strXPathExpression);
if (node != null)
{
XmlAttribute attribute = node.Attributes[strAttributeName];
if (attribute != null)
return attribute.Value;
}
return string.Empty;
}