Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Arie 224 posts 675 karma points
    Jul 25, 2013 @ 19:37
    Arie
    0

    404-handling of static (non-.NET) files in Umbraco?

    Has anyone figured out yet how to get Umbraco to handle "Not Found" for static (e.g. .html) files?

    IIS: 7.5
    .NET: 4.0, integrated pipeline
    Umbraco: 6.x.x

  • Arie 224 posts 675 karma points
    Jul 26, 2013 @ 00:11
    Arie
    100

    I've devised a way to handle this, although it's not the most elegant solution. In my case I had to handle requests for *.cfm files, since the old site ran on ColdFusion. The problem was that Umbraco wasn't handling these requests and thus it wasn't using the 404-page that I configured in Umbraco.

    A code snippet in the global.asax file does the trick, however. Here's the entire global.asax file:

    ---------------------------------------------------------------

    <%@ Application Codebehind="Global.asax.cs" Inherits="Umbraco.Web.UmbracoApplication" Language="C#" %>

    <script runat="server">

    protected void Application_BeginRequest(object sender, EventArgs e)

    {

           if(HttpContext.Current.Request.CurrentExecutionFilePathExtension == ".cfm")

           {

               Context.RewritePath("~/non-existing-URL-here-so-Umbraco-will-handle-the-404/");

           } 

    }

    </script>

    ---------------------------------------------------------------

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies