Recently, I've added a new feature to the Mono ASP.NET stack which allows one to modify the configuration settings on the application runtime, based on the operating system the ASP.NET application is executing on. This feature is Mono specific and is currently avaliable only from the svn trunk.
Why is it useful?
When developing ASP.NET applications which may be ran by the end user on either MS.NET/ISS or Mono/XSP/mod_mono, one may face a limitation of the .NET configuration system - the lack of conditional configuration constructs. Being unable to use different configuration settings for different operating systems/platforms, means that most of the time it is necessary to provide separate set of config files for every operating environment that differs to the other ones we support.
One example when such need arises is the usage of the WebParts feature of ASP.NET 2.0. As you may know, Mono currently does not support that feature and so applications which can optionally use it (like, e.g. MojoPortal) need to ship with a special configuration for Mono which excludes the WebPart configuration settings. Using settings mapping, it is possible to ignore the configuration sections related (and unsupported) by Mono.
Another, perhaps more common, scenario are file paths used in the Web.config file. Windows and Unix use different directory separator characters, Windows supports drive letters while Unix does not use them, a different character is (by convention) used to separate PATH-style variables under Windows (:) and Unix (;). While all those differencies can be dealt with easily in the application source code, it is not so for configuration files. A custom settings mapper can take care of the adjustments for you, seamlessly modifying "canonical" file paths used in the config file to the operating system the application runs on.
There's a pretty extensive document on how to use the feature in your application at http://mono-project.com/ASP.NET_Settings_Mapping
Subscribe to:
Post Comments (Atom)
2 comments:
Hey Marek,
Great Work! That will make it much nicer not having to manually change the Web.config file for Mono!
I'm going to test this now.
Cheers,
Joe Audette
Hello. This post is likeable, and your blog is very interesting, congratulations :-). I will add in my blogroll =). If possible gives a last there on my blog, it is about the Servidor, I hope you enjoy. The address is http://servidor-brasil.blogspot.com. A hug.
Post a Comment