我想在IIS 7.5中配置服务器端包含(SSI)。默认情况下,指示文件应作为SSI文件处理的文件扩展名为 .shtml 。但是,我想配置IIS,以便将具有 .html 扩展名的文件作为SSI文件处理。这是为了让我能够通过更改名为 footer.html 的单个文件来更改多个 .html 页面的页脚。
这是可能的,如果有,是否有任何警告?
我也会接受通过更改单个文件来更改多个HTML网页上的页脚的替代方法的建议。
答案 0 :(得分:1)
嘿得到的答案只需要更多的冲浪 这是您可以配置IIS服务器使用服务器端包含.html页面作为默认为.shtml提供的链接,但我不想这样做。这个链接非常有用
http://tech.mikeal.com/blog1.php/server-side-includes-for-html-in-iis7
答案 1 :(得分:0)
您可以尝试下面的内容。
配置示例
以下配置示例禁用默认网站中SSI文件的#exec命令。
<location path="Default Web Site">
<system.webServer>
<serverSideInclude ssiExecDisable="true" />
</system.webServer>
</location>
C#文件如下所示
using System;
using System.Text;
using Microsoft.Web.Administration;
internal static class Sample
{
private static void Main()
{
using (ServerManager serverManager = new ServerManager())
{
Configuration config = serverManager.GetApplicationHostConfiguration();
ConfigurationSection serverSideIncludeSection = config.GetSection("system.webServer/serverSideInclude", "Default Web Site");
serverSideIncludeSection["ssiExecDisable"] = true;
serverManager.CommitChanges();
}
}
}
您可以获得更多信息Server Side Include
第二个问题:
您可以使用母版页。然后,所有继承的网页都会包含页眉和页脚。
我希望这会对你有所帮助。