Copied to clipboard

Flag this post as spam?

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


  • Olov 27 posts 101 karma points
    Jun 02, 2014 @ 16:31
    Olov
    0

    Register url rewrite rule with code in ApplicationEventHandler

    I have tried to register a url rewrite rule using UrlRewriting.AddRewriteRule() in ApplicationEventHandler.OnApplicationStarted() but it seems to be to late.

    I also tried try to register it in ApplicationEventHandler.OnApplicationStarting() or ApplicationEventHandler.OnApplicationInitialized() but then UmbracoContext.Current is null and I cannot use the UmbracoHelper() class.

    Any ideas?

  • Richard Soeteman 4035 posts 12842 karma points MVP
    Jun 02, 2014 @ 16:56
    Richard Soeteman
    0

    Hi Olov,

    I don't have the answer to your original question but if you need this because of coding the rewrite rule for whatever reason instead of configuring in xml it might be good to know that you can extend the API of SEO Checker http://our.umbraco.org/projects/website-utilities/seo-checker as well to code your rewrite rules. Just a matter of implementing an interface.

    If you want to know more about this please let me know.

    Best,

    Richard

  • Olov 27 posts 101 karma points
    Jun 03, 2014 @ 08:00
    Olov
    0

    Hi Richard,

    SEO Checker seems to be nice, but overkill for what I want to do.

    *******

    I could reigster my rewrites in the config file but I'm a bit worried that the client would change the name of a page and then break the functionality and therefore I thought it would be handy to register it from code. Has anyone done something like this?

Please Sign in or register to post replies

Write your reply to:

Draft