Magnus Rahl
Mar 2, 2010
(0 votes)

Non-FURLs stop working after installing CMS 5 R2 SP2

After upgrading a site to EPiServer CMS 5 R2 SP2, incoming links on non-FURL format (i.e. http://host/template.aspx?id=xyz) stopped working. All such requests end up displaying the same garbled page, as if the start page template / IIS default document was loaded with the wrong PageData object.

A bug or a feature?

After some debate this behavior was accepted as a bug and should be fixed in the final release of CMS 6, if not before. But since CMS 6 is not released yet, and since an upgrade to CMS 6 is a bigger change than just a service pack, the bug can’t be corrected right away. I decided to post this workaround after hearing about several others having similar problems.

A workaround

I created a HTTP module, intercepting all requests. It only passes the incoming URL to the URL rewriter, which tries to rewrite the URL to a FURL. If it already is a FURL it will not be changed. This is the code for the module.

   1: namespace Sogeti.HttpModules
   2: {
   3:     public class InternalTolerantUrlRewriteModule : IHttpModule
   4:     {
   5:         public void Init(HttpApplication application)
   6:         {
   7:             application.BeginRequest += new EventHandler(this.RewriteInternalUrl);
   8:         }
  10:         protected virtual void RewriteInternalUrl(object sender, EventArgs e)
  11:         {
  12:             HttpApplication application = sender as HttpApplication;
  14:             if (application != null)
  15:             {
  16:                 UrlBuilder ub = new UrlBuilder(application.Request.Url.PathAndQuery);
  17:                 EPiServer.Global.UrlRewriteProvider.ConvertToExternal(ub, null, System.Text.Encoding.UTF8);
  18:                 application.Context.RewritePath(ub.ToString());
  19:             }
  20:         }
  22:         public virtual void Dispose()
  23:         {
  24:         }
  25:     }
  26: }

Add the HTTP module to the request pipeline by adding it in the system.web/httpModules web.config section, for IIS 5 / 6:

   1: <configuration>
   2:     <system.web>
   3:         <httpModules>
   4:             <add name="InternalTolerantUrlRewriteModule" type="Sogeti.HttpModules.InternalTolerantUrlRewriteModule, Sogeti.HttpModules" />
   5:         </httpModules>
   6:     </system.web>
   7: </configuration>

For IIS 7 / 7.5 in integrated pipeline mode (NB! I haven’t tested this in IIS 7 / 7.5):

   1: <configuration>
   2:     <system.webServer>
   3:         <modules>
   4:             <add name="InternalTolerantUrlRewriteModule" type="Sogeti.HttpModules.InternalTolerantUrlRewriteModule, Sogeti.HttpModules" />
   5:         <modules>
   6:     <system.webServer>
   7: </configuration>
Mar 02, 2010


Sep 21, 2010 10:33 AM

I think this is a known problem and a hotfix is available from EPiServer if you ask them.
/ Per

Magnus Rahl
Magnus Rahl Sep 21, 2010 10:33 AM

Good to know Per. I had many contacts with EPiServer in this issue when I first ran into it but was first informed that it was closed as by design, and then that it was indeed a bug and that it would probably make the CMS 6 release. Great that there's now a hotfix so CMS 6 upgrades don't have to be rushed.

Please login to comment.
Latest blogs
Optimizely community meetup - Sept 29 (virtual + Melbourne)

Super excited to be presenting this Thursday the 29th of September at the Optimizely community meetup. For the full details and RSVP's see the...

Ynze | Sep 27, 2022 | Syndicated blog

Preview multiple Visitor Groups directly while browsing your Optimizely site

Visitor groups are great - it's an easy way to add personalization towards market segments to your site. But it does come with it's own set of...

Allan Thraen | Sep 26, 2022 | Syndicated blog

The Report Center is finally back in Optimizely CMS 12

With Episerver.CMS.UI 12.12.0 the Report Center is finally re-introduced in the core product.

Tomas Hensrud Gulla | Sep 26, 2022 | Syndicated blog

Dynamic Route in ASP.NET Core When MapDynamicControllerRoute Does Not Work

Background Creating one of the add-on for Optimizely I had to deal with challenge to register dynamically route for the API controller. Dynamic rou...

valdis | Sep 25, 2022 | Syndicated blog