ASP in a .html file under .net 4.0

2019-08-04 19:16发布

问题:

I'm updating a site from asp.net 2.0 to asp.net 4.0.
I'm running IIS 7.0. If I create test.asp and browse to it it works. If I rename the file test.html it will not parse the asp.

I need html to be parsed as asp because of the CMS we use.

Relevant code from test.html:

<%
Response.Write ("The time on the server is: " & Time())
%>

I think my trouble comes from the way .net 4.0 handles requests.

How do I get IIS to parse html as asp?

回答1:

You will need to associate the same DLL that currently handles your .asp pages to also handle your .html pages in IIS. see here for help with that



回答2:

I don't see the connection between ASP and .NET here.

Are you trying to figure out why the ASP engine is not processing a file with the .HTML extension?

When you name a file with the .ASP extension, it will be processed by the ASP engine. When you name a file with some other extension, like .HTML, it will not be processed by the ASP engine so any ASP-specific markup in it will go through to the client.