2013-01-03 30 views
5

我想在IIS 7.5中配置服务器端包含(SSI)。默认情况下,表示文件应作为SSI文件处理的文件扩展名是.shtml。但是,我想配置IIS,以便将带有.html扩展名的文件作为SSI文件进行处理。这是为了让我通过更改一个名为footer.html的单个文件来更改页脚多个.html页面。配置IIS 7.5以启用服务器端包含用于'.html'扩展名的(SSI)

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

我也愿意接受替代方案的建议,通过更改一个文件来更改多个HTML页面上的页脚。

+1

**相关:** [使用web.config文件允许服务器端包含在HTML文件(IIS)](http://stackoverflow.com/q/17688185/ 1497596) – DavidRR

回答

2

嗨得到了答案只是需要冲浪一些 这里是您可以配置IIS服务器使用服务器端包括.html页面作为其默认提供.shtml的链接,但我并不想这样做。这个环节是非常有帮助的

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

+1

不幸的是,提供的链接不再可用。这就是为什么只有链接的答案可能会有问题。 – DavidRR

+0

链接再次工作。 – edt

+0

链接不再工作:( – NickG

0

你可以尝试下面的东西。

配置方案

以下配置示例禁用在默认Web站点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

对于您的第二个问题:

您可以使用母版页。然后全部继承ited页面将包含标题和页脚。

我希望这对你有帮助。

+0

谢谢Sampath bhai我也找到了一个解决方案。 – Prem

+0

@ArvindMehra确实很好。 – Sampath

相关问题