After recently updating a 7.65 based website to 8.0 we recently found that parts of the workarea were unusable. The upgrade went well and all the pre-deployment checks went well. However, when we performed the UAT deployment the workarea was broken. Where the treeview menu on the left should be, there was a helpful message:
This is a marker file generated by the precompilation tool, and should not be deleted!
Well, yes the UAT deployment is the first production quality deployment so precompilation is part of the build and this is part of the message that’s within all of the precompiled UI files (aspx, ascx, ashx, etc). But on a precompiled site, the pages are actually stored in dll’s in the site’s bin folder – the actual files are a nicety to ensure IIS routes the request the ASP.Net.
Clearly this mechanism was working for aspx files as the frontend website worked as well as bits of the workearea. After a bit of investigation, it appears that html and htm files are also being precompiled using the standard PageBuildProvider:
1: <compilation debug="false">
2: <buildProviders>
3: <add extension=".htm"
4: type="System.Web.Compilation.PageBuildProvider" />
5: <add extension=".html"
6: type="System.Web.Compilation.PageBuildProvider" />
7: </buildProviders>
8: </compilation>
The Fix
In the web.config ensure the following handler mappings are added to configuration/system.webServer/handlers:
1: <!--
2: Add Under the aspx mapping for Integrated Mode
3: <add name="PageHandlerFactory-Integrated" path="*.aspx" verb="GET,HEAD,POST,DEBUG" type="System.Web.UI.PageHandlerFactory" preCondition="integratedMode"/>
4: -->
5: <add name="Html-Integrated" path="*.html" verb="GET,HEAD,POST,DEBUG" type="System.Web.UI.PageHandlerFactory" preCondition="integratedMode"/>
6: <add name="Htm-Integrated" path="*.htm" verb="GET,HEAD,POST,DEBUG" type="System.Web.UI.PageHandlerFactory" preCondition="integratedMode"/>
7: <!-- Add under the aspx mapping for Classic Mode
8: <add name="PageHandlerFactory-ISAPI-2.0" path="*.aspx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness32" responseBufferLimit="0"/>
9: -->
10: <add name="Html-ISAPI-2.0" path="*.html" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness32" responseBufferLimit="0"/>
11: <add name="Htm-ISAPI-2.0" path="*.htm" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness32" responseBufferLimit="0"/>
12:
The lines above are for IIS 7, if the same issue occurs on an earlier version then it should be trivial to add appropriate entries to configuration/system.web/httpHandlers.
It’s important that these handlers are registered prior to any wildcard handlers (path=”*.*”) and is mapped to the standard ASP.Net handler. If it’s mapped to the Ektron EkDavHttpHandlerFactory then the html and htm files will be served as text and not processed as a serverside page.
Hi Martin
ReplyDeleteWill your solution have a problem if using URL aliasing and make .html/.htm as extension?
Rui @ Ektron
Possibly, I haven't tried it. But of it does you should be able to get aliasing working buy changing the handler mapping to the EkDavHandler. I suspect a fix for both issues will require a new handler to be created that inherits the patron handler functionality but ensures that of the appropriate htm/html page exists on the file system then the request is passed off to the simple handler factory.
ReplyDeleteHi Martin,
ReplyDeleteI am bit confused when i do this for ASP.Net 2.0 version and IIS 6.0. Should i create a handler file and the above fix in the web.config?
Thanks in Advance
Regards,
Joseph