Magnus Rahl
Mar 2, 2010
  4442
(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:         }
   9:  
  10:         protected virtual void RewriteInternalUrl(object sender, EventArgs e)
  11:         {
  12:             HttpApplication application = sender as HttpApplication;
  13:  
  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:         }
  21:  
  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

Comments

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
Performance optimization – the hardcore series – part 2

Earlier we started a new series about performance optimization, here Performance optimization – the hardcore series – part 1 – Quan Mai’s blog...

Quan Mai | Oct 4, 2023 | Syndicated blog

Our first steps into local AI

After a consumer of tools like ChatGPT and CoPilot, we as developers like to dive deeper into it. How does it work? Where to start? Can I create my...

Chuhukon | Oct 4, 2023 | Syndicated blog

Update on .NET 8 support

With .NET 8 now in release candidate stage I want to share an update about our current thinking about .NET 8 support in Optimizely CMS and Customiz...

Magnus Rahl | Oct 3, 2023

Adding Block Specific JavaScript and CSS to the body and head of the page

A common requirement for CMS implementations includes the ability to embed third party content into a website as if it formed part of the website...

Mark Stott | Oct 3, 2023

Performance optimization – the hardcore series – part 1

Hi again every body. New day – new thing to write about. today we will talk about memory allocation, and effect it has on your website performance....

Quan Mai | Oct 3, 2023 | Syndicated blog

Next level content delivery with Optimizely Graph

Optimizely introduced a new product called Optimizely Graph earlier this year. We were one of the first partners to adopt this new service in a...

Ynze | Oct 2, 2023 | Syndicated blog