Blogger :
MSDN Blogs
All posts :
All posts by MSDN Blogs
Category :
SAPscript
Blogged date : 2008 May 06
Last year I've published a simple ASP.NET control, called ‘Dynamic Client Script', that enables IronPython client scripting in ASP.NET pages in Silverlight 1.1 Alpha. Since then Silverlight evolved quite a bit and Silverlight 2 Beta 1 has been released. According to the new model, Silverlight applications are published as XAP archives containing the application code, so I've updated the Dynamic Client Script sample to work with the new model.
The user model for Dynamic Client Script stays the same -- all user needs to is to drop the control onto an ASP.NET page:
<asp:DynamicClientScript runat="server" ID="MyScript" Source="myscript.py" />
The control does all the magic, including generation of Silverlight object tag with the link to the Silverlight application (XAP archive) pointing back to the page as a request with a special path-info. That request gets intercepted by the control, and it creates the XAP archive on the fly, and caches it across requests with the right cache dependencies so it only gets re-created when the page or the script changes.
The XAP creation code comes from Chiron, a development web server that we ship with Dynamic Languages SDK for Silverlight. Chiron automatically creates XAP archives from any directory, to facilitate development of Silverlight application in dynamic languages. Dynamic Client Script control does not require Chiron, it works with any ASP.NET web server, including IIS (and Cassini as well).
The updated sample:
- Allows script inline in the ASP.NET page or in a separate file
- Supports IronPython, IronRuby, Managed JScript
- Supports multiple instances of Dynamic Client Script control on the same ASP.NET page
- Includes all DLR assemblies and compliers
- Includes sample pages
The attached package includes all the sources, binaries, and samples.