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.
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.
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?
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?
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
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?
is working on a reply...