exyus makes svg support easy

2007-12-02 @ 22:53#

i was playing with SVG tonight - just checking things out using the MSIE plugins (they still all stink) - and ran into a problem w/ IIS. it does not properly serve up image/svg+xml. this causes even smart browsers like FF to pop up a dialog asking which app should be used to render the .SVG file - sheesh!

i tried pfutzing with the IIS mime types table, but that didn't work. instead, i whipped up a simple exyus resource class to properly handle the SVG mime type. it looks like this:

[UriPattern(@"/svg/hello/(\.xcs)(.*)?")]
[MediaTypes("image/svg+xml")]
public class svgHello : GetHandler
{
    public svgHello()
    {
        this.ContentType = "image/svg+xml";
        this.Content = Helper.ReadFile("/xcs/content/hello.svg");
    }
}

it would be easy to modify the UriPattern to sniff for any file/folder collection and render it with the proper mime type.

code