Пропустить и перейти к основному содержимому

Server Side Includes (SSI) in Microsoft Azure Web Sites

Опубликовано 26 марта, 2014

Program Manager, Azure Web Sites
A common question among Microsoft Azure Web Sites customers is related to our support for Server Side Includes (SSI) and whether it can work with different extensions like .htm. Up until a few months ago this feature wasn’t available, as you could probably see by browsing our support forums. However, this is no longer the case and now the ServerSideIncludeModule is included in Microsoft Azure Web Sites and fully supported. Server Side Includes are a simple way of embedding the content of one file into another, and are commonly used in web applications. An SSI could be as simple as one page embedding the content of another, but more often it’s used to build a modular web application, where a file containing some code could be called by multiple other files. For example, this piece from some unnamed web app uses several include statements: By default, SSI on Windows Azure Web Sites is configured to work only for the *.stm, *.shtm and *.shtml file extensions, but occasionally, one might need to extend it to others. Naturally, there’s no right or wrong here – it’s all about how a web application is designed, and if you need to move an application that was built with other extensions, you would need to extend the default configuration in WAWS to support it. Adding other extensions is quite simple. All you have to do is create a small Web.Config file for your site. This configuration describes the addition to the SSI module handler, and the format is as follows. This example shows adding support for including .htm files: Note: If you currently don’t have a web.config in your website you can simply copy all of the above into a text file, save it as web.config and upload it to your web site using either Web Matrix or via FTP. If you do have an existing web.config, you would add the <handlers> section in your system.webServer section, or if you don’t have one, add the entire <system.webserver> section in your Configuration section. If you are interested in learning more about SSI, a detailed guide can be found here. This post was written by Cristhian Uribe  and Erez Benari