View Full Version : asp code in .html file?

01-11-2005, 11:46 AM
Is there any way to configure IIS to allow asp code in a file with a .html extension?


01-11-2005, 12:24 PM
i believe you can do that.
Open your site/virtual dir in IIS, click the configuration button (on the virtual dir tab or the home dir tab) click add, point to the asp.dll, enter the html extension, save and you should be ready.
Better to restart the server service to make sure changes take effect.

Good luck with it.

01-11-2005, 02:02 PM
template.html refuses to parse asp code, even though IIS has been configured to parse asp code in files with the .html extension. I have tested it with another html file and it parses fine (in every directory). Perhaps you can determine, by the snippet of code below, why template.html will not - and hopefully provide a solution?

set fs = CreateObject("Scripting.FileSystemObject")

IF NOT fs.FileExists(Server.MapPath("templates\template.html")) THEN
response.write("<p>An error has occured.</p><p>The &quot;template.html&quot; file does not exist. Please make sure that your HTML template is in the &quot;templates&quot; folder and the file name is &quot;template.html&quot;")

set file = fs.OpenTextFile(Server.MapPath("templates\template.html"),1,0)

HTML_string = file.ReadAll

set file = nothing

01-11-2005, 02:44 PM
Are you sure the code is enclosed in <% and %> ? Or you configured a different directory?

01-11-2005, 09:00 PM
try simple asp code, with no chance of makin typos, like

Response.Write "Boo"