我試圖使用外部配置文件來定義我的web.config文件的根<configuration>
節內有多個location
元素的一部分。這可能嗎?外部配置文件進行配置部分
我知道如何爲單個部分(例如connectionStrings
),但是可以在此爲配置元件內的多個元件來實現這樣做呢? <configuration>
;本身不允許configSource
屬性。是否有可能創建一個虛擬元素並在configSections
中定義它,如果是的話,我會給它一個類型?
背景資料:我想這樣做,這樣我可以定義永久重定向,可能有數百人因此,最好我不想在web.config中本身來定義這一點。即
<configuration>
<!-- rest of web.config here -->
<!-- i need mutiple location elements so want these in an external file-->
<location path="oldpage">
<system.webServer>
<httpRedirect enabled="true" destination="/uk/business" httpResponseStatus="Permanent" />
</system.webServer>
</location>
</configuration>
謝謝 - 我想我的問題可能會受到嚴重的措辭,這是什麼,我知道該怎麼做的例子,但我不使用重寫部分我想將位置元素添加到配置部分。我會用一個例子更新我的問題。 – deadcrab 2012-04-16 13:10:57