Project Description
This project is an HTTP module to make html served up via .net and Umbraco xhtml compliant and Sitemorse friendly.

This project is an HTTP module developed by IASB2B (read more here) to make html served up via .net and Umbraco xhtml compliant
and Sitemorse friendly. The code was orignally written with Immediacy CMS in mind then extended to handle MCMS 2002 and then further extended for Umbraco. Originally developed by Ryan Roberts and further extended by Ismail Mayat

It makes use of the MIL html parser from code project. This library produces a domain tree of a
given HTML document, allowing the developer to navigate and change the document in a methodical way.
In addition to the basic HTML production, this library can also be used to produce XHTML documents, as it includes an HTML 4 entity encoder.

The HTTP module using MIL parser creates the browsable document and fixes any issues with the html eg:
  1. onfocusout' attributes removed from all elements.
  2. 'id' attribute removed from title.
  3. 'width'/'height' attributes removed from all elements except for table/img.
  4. 'hspace'/'align' attributes removed from all elements.
  5. 'name' attribute removed from form tags.
  6. 'border' removed from img tags, longdesc is subtitued for alt.
  7. language="javascript" replaced with type="text/javascript".
  8. Object ids Leading underscores are removed from all id attribute values.
  9. Leading underscores removed from all for attribute values.
  10. Apostrophes removed from embedded javascript in onfocus attributes
  11. ASP.NET hidden form variables (VIEWSTATE,EVENTARGUMENT and EVENTTARGET) are now wrapped in a div element.
  12. Xml namespace processing instructions are removed from body of HTML.
  13. Div and anchor termination is enforced as <div></div>,<a></a> rather than <a/>,<div/>
  14. All hrefs are HtmlAttributeEncoded

and plenty of other things.

Installation instructions

The filter will work for Umbraco 2 and 3 however they must be running under .net20.

Download the dll and copy it to the bin directory of your Umbraco installation. Copy the compliance.config file over to the config directory
of your umbraco installation. The has the following format

<!-- if using ajax then leave as false else ajax stuff will not work
this remove id underscore is for sitemorse

The only value of concern is UmbracoReservedUrl this is a comma separated list of pages that need to be ignore by the module. It should always have the umbraco editor url. It may also contain specific pages that you wish to ignore for what ever reason.

In your web.config add the following:

under configSections add

<section name="ComplianceConfig" type="ComplianceFilter.ConfigSectionHandler, ComplianceFilter,Version=, Culture=neutral, PublicKeyToken=a92106508d9da1f3"/>

and after configSections tag add

<ComplianceConfig configSource="config\Compliance.config" />

To the httpmodule section add

<add name="ComplianceFilter" type="ComplianceFilter.ComplianceFilter,ComplianceFilter,Version=, Culture=neutral, PublicKeyToken=a92106508d9da1f3" />

To uninstall uncomment line above.

In order to determine if the httpmodule is being applied hit a page on your website and view the source you should see in the head tags

<meta name="RiverInteractive.ComplianceFilterTest" content="v2.0.50727" />

Known issues

If you are using ajax controls they may stop working. I definately had an issue with the calendar extender and thus for page using it I added it to filter list. I also have issue with another ajax calendar. I think its something to do with the compliance filter stripping invalid characters from id attributes.

The other issue I have encountered is when in the html tag you have

<html xmlns="" xml:lang="en" lang="en">

then you get incorrect rendering of the html tag it does not seem to like the lang bit. If you use

<html xmlns="">

it works fine.

If you use the ?umbDebugShowTrace=true to get umbraco debugging then for some reason you only get half the trace. Could do with updating the filter so that when the umbDebugShowTrace=true querystring parameter is present then compliance filter gets ignored.

If anyone wants to contribute to the library leave a comment and I will add you as a developer.

Last edited May 19, 2008 at 10:40 AM by ismailm, version 28