Copied to clipboard

Flag this post as spam?

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


This forum does not allow new topics to be created, please use the v2 forum from now on.

  • Martin Rud 103 posts 295 karma points
    Mar 31, 2011 @ 11:59
    Martin Rud
    0

    Getting InfoCasters 301 URL Tracker to handle *.html extensions

    Hi forum,

     

    (I was advised to post this question in this part of the forum - posted it earlier in http://our.umbraco.org/forum/getting-started/installing-umbraco/15880-Getting-InfoCasters-301-URL-Tracker-to-handle-starhtml-extensions)

     

    I have installed the 301 URL Tracker package from InfoCaster. It works great, but my site has some old URL´s ending with a ".html".

    I would like to get 301 URL Tracker to handle these *.html extensions so the module can send vistors to the changed URL with a 301 redirect.

    I have tried setting up my web.config (I have no access to the ISS server), but I can´t get it working:

    I added this line i web.config:

    <add name="htmlext" path="*.html" verb="*" type="InfoCaster.Umbraco._301UrlTracker.Handler301URLTracker, InfoCaster.Umbraco._301UrlTracker" />

     

    ... but I get this error:

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

    Server Error in '/' Application.

    InfoCaster.Umbraco._301UrlTracker.Handler301URLTracker, InfoCaster.Umbraco._301UrlTracker does not implement IHttpHandlerFactory or IHttpHandler.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

    Exception Details: System.Configuration.ConfigurationErrorsException: InfoCaster.Umbraco._301UrlTracker.Handler301URLTracker, InfoCaster.Umbraco._301UrlTracker does not implement IHttpHandlerFactory or IHttpHandler.

    Source Error: 

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace: 

    [ConfigurationErrorsException: InfoCaster.Umbraco._301UrlTracker.Handler301URLTracker, InfoCaster.Umbraco._301UrlTracker does not implement IHttpHandlerFactory or IHttpHandler.]

       System.Web.Configuration.HandlerFactoryCache.GetHandlerType(String type) +9026211

       System.Web.Configuration.HandlerFactoryCache..ctor(String type) +19

       System.Web.HttpApplication.GetFactory(String type) +81

       System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +223

       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184

     

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

     

    Can my addition to web.config be adjusted to get this working?

     

    Regards,

    Martin

  • Stefan Kip 1606 posts 4098 karma points c-trib
    Mar 31, 2011 @ 12:49
    Stefan Kip
    1

    Doug Mackay had a great suggestion in another topic, will work with .html too I think:

    I've been investigating the issue of getting it to work with .php/.cfm pages :-

    I belive that the umbraco 404 handlers only work with .aspx or extensionless url's (this is hard coded into the umbraco requestModule).

    As a workaround you can set-up the UrlRewritter to rewrite .php requests to a .aspx page that does't exist :-

     name="phprewrite"
    virtualUrl="^~/(.*).php"
    rewriteUrlParameter="ExcludeFromClientQueryString"
    destinationUrl="~/php/$1.aspx"
    ignoreCase="true" />

    This then enables you to use the custom mapping in the 301 URL Tracker

    e.g.

    Custom mappings :-

    /php/oldpage.aspx

    /php/olddir/oldpage.aspx

    So /oldpage.php or /olddir/oldpage.php will get 301 redirected to the umbraco page that you've set the custom mapping on.

  • Martin Rud 103 posts 295 karma points
    Mar 31, 2011 @ 13:50
    Martin Rud
    0

    Hi,

    I´ve tried the above but it sends the "/php/olddir/oldpage.aspx" and "/php/oldpage.aspx" to my custom 404 page. Its better than before where it went to to IIS´ 404 page (Server Error in Application...)

     

    /Martin

  • Murray Roke 467 posts 875 karma points c-trib
    Mar 27, 2012 @ 05:57
    Murray Roke
    0

    I have this working but...

    It seems a bit of a 'hack' what if you want to use *.php or *.html for certain content AND have other specified html pages redirect.

    Additionaly it's not very intuitive for editorial staff.

  • Stefan Kip 1606 posts 4098 karma points c-trib
    Mar 27, 2012 @ 09:19
    Stefan Kip
    0

    @Murray

    I know, if you have a better solution you're more than welcome to share. AFAIK it's very hard, maybe impossible, to make this work some other way... 

  • Murray Roke 467 posts 875 karma points c-trib
    Mar 27, 2012 @ 10:37
    Murray Roke
    0

    Sounds like a worthy challenge. :-)

    My thought, which I have no idea if this would work nicely: write a custom http module which directly called the 301UrlTracker to check the DB.

    I think this would intercept all requests? Then it will need some internal logic (perhaps a whitelist of extensions) to ensure there's minimal performance impact on irrelevant pages.

    Thoughts?

  • Stefan Kip 1606 posts 4098 karma points c-trib
    Mar 27, 2012 @ 10:39
    Stefan Kip
    0

    Nope, won't work... The whole issue is; IIS won't use the ISAPI handler (aspx handler) for *.php and *.html requests. So umbraco/asp.net won't receive the request at all.

  • Murray Roke 467 posts 875 karma points c-trib
    Mar 27, 2012 @ 11:12
    Murray Roke
    0

    Assuming I'm using integrated pipeline and <modules runAllManagedModulesForAllRequests="true"> I'm assuming this is how urlRewriting.net module is getting a chance to do it's redirect.

  • Stefan Kip 1606 posts 4098 karma points c-trib
    Mar 27, 2012 @ 11:14
    Stefan Kip
    0

    Do *.php and *.html requests hit the UrlRewriting.NET module? (O_o)

  • Alex 10 posts 30 karma points
    May 03, 2012 @ 04:08
    Alex
    0

    yes the UrlRewriting.NET  picks up .html requests. It handles those fine.  I do see that it is running a httpModule which might be feilding the request before umbraco. Dont quote me on that though, havent tested it.

  • Stefan Kip 1606 posts 4098 karma points c-trib
    May 07, 2012 @ 09:32
    Stefan Kip
    0

    Hmm interesting, valueable information for a future release of the URL Tracker for umbraco v5.

  • 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