6

我想在 IIS 7.5中配置服务器端包含 (SSI) 。默认情况下,指示文件应作为 SSI 文件处理的文件扩展名是.shtml。但是,我想配置 IIS,以便将扩展名为.html的文件作为 SSI 文件处理。这是为了使我能够通过更改名为footer.html的单个文件来更改多个.html页面的页脚。

这是可能的吗?如果可以,是否有任何警告?

我也会接受有关通过仅更改单个文件来更改多个 HTML 页面上的页脚的替代方法的建议。

4

2 回答 2

1

嘿得到了答案,只需要再上网一下 这是您可以配置 IIS 服务器以使用 .html 页面的服务器端包含作为其为 .shtml 提供的默认设置的链接,但我不想要那个。这个链接很有帮助

http://tech.mikeal.com/blog1.php/server-side-includes-for-html-in-iis7

于 2013-01-04T07:13:59.277 回答
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

对于您的第二个问题:

您可以使用母版页。然后所有继承的页面将同时具有页眉和页脚。

我希望这对你有帮助。

于 2013-01-03T11:58:35.380 回答