Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Magnus Rahl
Mar 2, 2010
  4534
(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
Solving the mystery of high memory usage

Sometimes, my work is easy, the problem could be resolved with one look (when I’m lucky enough to look at where it needs to be looked, just like th...

Quan Mai | Apr 22, 2024 | Syndicated blog

Search & Navigation reporting improvements

From version 16.1.0 there are some updates on the statistics pages: Add pagination to search phrase list Allows choosing a custom date range to get...

Phong | Apr 22, 2024

Optimizely and the never-ending story of the missing globe!

I've worked with Optimizely CMS for 14 years, and there are two things I'm obsessed with: Link validation and the globe that keeps disappearing on...

Tomas Hensrud Gulla | Apr 18, 2024 | Syndicated blog

Visitor Groups Usage Report For Optimizely CMS 12

This add-on offers detailed information on how visitor groups are used and how effective they are within Optimizely CMS. Editors can monitor and...

Adnan Zameer | Apr 18, 2024 | Syndicated blog