开发者

WebMatrix parse .html file as .asp

开发者 https://www.devze.com 2023-02-28 13:35 出处:网络
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 is

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 t开发者_C百科hey 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>
0

精彩评论

暂无评论...
验证码 换一张
取 消