Community Server blogs images not working from Live Writer

So according to this post there is was an issue with the encoding of underscore characters (_) they get partially translated to _5F00_ - meaning they get translated everywhere except in the file system, which means they end up as broken links. Im sure CS will get fixed in due course, but I got thinking how can I quickly fix this.

I found this great open source url rewriter tool which will allow me to change the _5F00_ back to _ .

This was tested and worked under IIS 7 on windows 2008, let me know if you test it on other versions and I will update the post.

I decided to install the re-writer in the root of the site so I could add other rules, but it will also work just in the CS application.

1. Download the package and copy the dll file into the bin directory:

image

2. Modify the web.config to use the re-writer (full info here) - take care when copying text into here with quotes, you should always retype the quotes " using the keyboard as the funny web quotes will break your site. here is my minimal web.config :

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <configSections>
    <section
    name="rewriter"
    requirePermission="false"
    type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" />
  </configSections>
    <system.webServer>
        <modules>
            <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter" />
        </modules>
    </system.webServer>
  <rewriter>
    

<rewrite url="^(.*)cfs-file.ashx/__key(.*)" to="$1filestorage$2" />
     <rewrite url="^(.*)_5[fF]00_(.*)" to="$1_$2" />
    <rewrite url="^(.*)_5[fF]00_(.*)" to="$1_$2" />
    <rewrite url="^(.*)_5[fF]00_(.*)" to="$1_$2" />

  </rewriter>
    <system.web>
        <compilation defaultLanguage="vb">
            <assemblies>
                <clear />
                <add assembly="mscorlib" />
                <add assembly="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
                <add assembly="System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
                <add assembly="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
                <add assembly="System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
                <add assembly="System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
                <add assembly="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
                <add assembly="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
                <add assembly="System.EnterpriseServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
                <add assembly="System.Web.Mobile, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
                <add assembly="*" />
                <add assembly="System.Runtime.Serialization, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL" />
                <add assembly="System.IdentityModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL" />
                <add assembly="System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
                <add assembly="System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
                <add assembly="System.WorkflowServices, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
                <add assembly="Intelligencia.UrlRewriter.RewriterHttpModule" />
            </assemblies>
        </compilation>
    </system.web>
</configuration>

3. On a side note it turned out this was not the only issue it seems the file handler was broken so I also added a replacement for 'cfs-file.ashx/__key' ->  'filestorage'

4. Because I configured this in the root site, I had to make sure that CS was using IIS integrated mode as well (it was previously set to classic)

5. I ran my rewrite 3 times (to handle multiple instances of the _) im sure there must be a better way than that but it worked so I left it.

[edit] So it turned out to that the problem was fixed simply by setting up CS to use IIS in integrated mode. 


Posted Sep 04 2008, 10:33 AM by simon
Powered by Community Server (Non-Commercial Edition), by Telligent Systems