BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News IronPython for ASP.NET

IronPython for ASP.NET

Microsoft has released an extension that allows IronPython to be used with ASP.NET. More importantly, they have created a route for other dynamic languages to tie into the ASP.Net framework.

According to David Ebbo of Microsoft, the primary reason why dynamic languages such as IronPython couldn't be used with ASP.Net is that they don't support static typing. ASP.Net relies heavily on CodeDOM, which assumes "that any language used for ASP.NET has the ability to produce true classes in the .NET Framework sense—that is, classes that are in on-disk assemblies and that can be loaded using standard APIs like Type.GetType." This means that any dynamic language that wanted to support ASP.NET would have to be extended.

Microsoft solved this problem by turning off page compiling and using a custom PageParserFilter. This routes some of the python code through a new base class called ScriptPage and the rest through controls. A similar mechanism is used for user controls and master pages. And because the pages don't need to be compiled, the usual first-time hit will be significantly less.

A variant of the application file is supported, as well as an App_Script directory (replaces App_Code, and HTTP handlers. Web services are not supported, as they require language features not available in most dynamic languages.

Currently ASP.NET doesn't scale well when too many unique pages are created. The cost to compile, load, and manage all of the page specific assemblies can seriously stress the server. Since dynamic pages eliminating the need to create an assembly for each page, there is no theoretical limit on the number of unique pages.

Runtime performance is expected to be nearly the same as C#. While late-bound code is slower, most of the processing time is spent in the framework code rather than the user code.

Rate this Article

Adoption
Style

BT