I have a file with .html extension that contain the:
<!--#include virtual="filename"-->
directive and I'm using Microsoft WebMatrix. When I run the web pages from WebMatrix the directive isn't processed and instead the directive shows up in the HTML. How can I configure WebMatrix to treat these pages as if they were .asp files?
You need to configure the web server to map .html files to asp.dll. If you want to do this locally with IIS Express, you can add a new entry to the applicationhost.config file under the <handlers>
section like this:
<add name="ASPClassicHtml" path="*.html" verb="GET,HEAD,POST"
modules="IsapiModule" scriptProcessor="%IIS_BIN%\asp.dll"
resourceType="File" />
That's basically a copy of the existing entry for ASPClassic, but pointing to html files. You can usually find applicationhost.config in My Documents > IISExpress > config.
To enable Server Side Includes without passing all HTML files through the ASP processor, you can add these two "add" elements to the handlers section. Make sure you add it to the beginning of the section.
<handlers accessPolicy="Read, Script">
<add name="SSINC-htm" path="*.htm" verb="GET,POST" modules="ServerSideIncludeModule" resourceType="File" />
<add name="SSINC-html" path="*.html" verb="GET,POST" modules="ServerSideIncludeModule" resourceType="File" />
...
...
...
</handlers>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With