Showing posts with label iis. Show all posts
Showing posts with label iis. Show all posts

30 August 2006

Mono is not an adaptive asp.net web rendering engine

Scott Mitchell writes in ASP.NET.4GuysFromRolla.com: A Look at ASP.NET's Adaptive Rendering: IIS ASP.NET renders web controls by first detect the user-agnet type, for this reason, ASP.NET Web controls are called adaptive. By default it renders HTML 3.2-compliant markup using tagwriter=System.Web.UI.Html32TextWriter. For
HTML 4.0-compliant agents (Mozilla/4.0 and above, e.g. MSIE6) it uses
tagwriter=System.Web.UI.HtmlTextWriter. IIS does so by having a regex check for browser User-Agent. However, the default implementation doesn't address FireFox 0.8 and above, which is Mozilla/5.0 and HTML 4.0-compliant.
Here we will check the adaptive rendering issue around Mono1.x ASPNET instead of IIS.

Default behaviour
1. Test rendering by Mono XSP web server.
On MSIE 6.0: tagwriter=System.Web.UI.HtmlTextWriter
evidence: System.Web.UI.WebControls.WebControl is rendered as <div>
On FireFox 1.5: tagwriter=System.Web.UI.HtmlTextWriter
evidence: System.Web.UI.WebControls.WebControl is rendered as <table >
Mono1.1 doesn't address adaptive Rendering - there is no <browserCaps> in its machine.config

2. Test rendering by IIS6
On MSIE 6.0: tagwriter=System.Web.UI.HtmlTextWriter
evidence: System.Web.UI.WebControls.WebControl is rendered as <div>
On FireFox 1.5: tagwriter=System.Web.UI.Html32TextWriter
evidence: System.Web.UI.WebControls.WebControl is rendered as <table ><tr><td>

It seemed that Mono team get around the problem luckily because it was born at a time HTML 4.0-compliant browsers prevails. (At least it was what they thought?). But maybe we can still add <browserCaps> for backward adaptive? At least it looks straightforward enough to add Add <browserCaps> to web.config to enable mono becomes aptive.
Not quite though.
Checking native .net1.x machine.config, in <configuration><configSections> there is:
<section name="browserCaps" type="System.Web.Configuration.HttpCapabilitiesSectionHandler, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
HttpCapabilitiesSectionHandler handles <browserCaps>. However, mono1.x build System.Web does NOT contain type HttpCapabilitiesSectionHandler implementation.

Conclusion: Mono1.X is not an adaptive ASPNET rendering engine.

Ideally we could add this to Web.config (affect single web app) or machine.config (affect all web apps on the machine)

<configuration>
...
<configSections>
...
<sectionGroup name="system.web">
<section name="browserCaps" type="System.Web.Configuration.HttpCapabilitiesSectionHandler , System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
...
</sectionGroup>
</configSections>
<System.Web>
...
<browserCaps>
<!-- if (working on web.config) { copy all <browserCaps> section from machine.config} -->
<!-- copy Rob Eberhardt's <browserCaps> (http://slingfive.com/pages/code/browserCaps/browserCaps_spaces.txt ) -->
</browserCaps>
...
</System.Web>

Technorati Tags: MONO ASPNET