私は、私がのConfigurationSection、のConfigurationElementとをConfigurationElementCollectionを使用することが出来るのです道を間違って何かをしていない限り、そのように私の構成セクションをフォーマットするために私が必要になります。web.configファイルのカスタムのConfigurationSection、不要な冗長性
<serviceAuthorization>
<credentials>
<login username="system" password="password" mode="include">
<services>
<service type="AxeFrog.Mobile.Service.Security.AuthenticationService, AxeFrog.Mobile.Service" />
<service type="AxeFrog.Mobile.Service.Security.AnotherService, AxeFrog.Mobile.Service" />
</services>
</login>
<login username="test" password="pass" mode="exclude" />
</credentials>
</serviceAuthorization>
I私はフォーマットでもう少し言いたいことがあればもっと好むだろう。
<serviceAuthorization>
<login username="system" password="password" mode="include">
<service type="AxeFrog.Mobile.Service.Security.AuthenticationService, AxeFrog.Mobile.Service" />
<service type="AxeFrog.Mobile.Service.Security.AnotherService, AxeFrog.Mobile.Service" />
</login>
<login username="test" password="pass" mode="exclude" />
</serviceAuthorization>
設定セクションのXMLを取得して、それを自分で読む方法はありますか?
string docName=System.Web.HttpContext.Current.Server.MapPath("Web.config");
XmlDocument configDoc = new XmlDocument();
configDoc.Load(docName);
をしてからconfigDoc
から作業:
私が理解しているように、IConfigurationSectionHandlerは非推奨になっています –
あなたは絶対に正しいです。私はそれを私の答えに加えました。 –