Configuring IIS 7.5 to enable the server side includes (SSI) for the extension ".html"

I want to configure Server Side Includes (SSI) in IIS 7.5. By default, the file extension indicates that the file should be processed as an SSI, .shtml file. However, I want to configure IIS so that .html files are treated as SSI files. This will allow me to change the footer for multiple .html pages by changing a single file called footer.html .

Is this possible, and if so, are there any reservations?

I would also be susceptible to suggestions for alternative approaches to changing the footer on multiple HTML pages by changing just one file.

+5
source share
2 answers

Hey, got the answer, just needed for surfing a little more. Here is a link where you can configure the IIS server to use Server side include for .html pages, since it defaults to .shtml, but I didn’t want that. this link is very useful

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

+2
source

You can try something similar below.

CONFIGURATION SAMPLE

The following configuration example disables the #exec command for SSI files on the website by default.

<location path="Default Web Site"> <system.webServer> <serverSideInclude ssiExecDisable="true" /> </system.webServer> </location> 

C # file looks below

 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(); } } } 

You can get more information on the server side.

For your second question:

You can use the master page . Then, all inherited pages will have both headers and footers.

Hope this helps you.

0
source

Source: https://habr.com/ru/post/949617/


All Articles