簡體   English   中英

從 ASP.NET 中的 web 配置轉換默認文檔屬性

[英]Transform Default Document attribute from web config in ASP.NET

如何在 ASP.NET 中轉換 DefaultDocument。 我能夠使用 Key 轉換其他標簽。 但是在我的 Web.config 中,web 配置中不允許使用“Key”屬性。

Web.Config

<defaultDocument>
      <files>
        <add Key="DefaultDocument" value="Document1.aspx"  />
      </files>
    </defaultDocument>

SecondWeb.config

<system.webServer>
    <defaultDocument>
      <files>
        <add  key="DefaultDocument" value="Document2.aspx"  xdt:Transform="Replace" xdt:Locator="Match(key)"/>
      </files>
    </defaultDocument>
  </system.webServer>

您只需將 defaultDocument 元素添加到每個配置轉換文件中,如下所示:

 <system.webServer> <defaultDocument xdt:Transform="Insert"> <files> <clear/> <add value="Default.aspx"/> <add value="index.html"/> </files> </defaultDocument> </system.webServer>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM