Try our conversational search powered by Generative AI!

UrlRewriteProvider and UrlRewriteModule

Vote:
 

Hi!

Trying to achieve something similar to this

http://www.site.com/sports/basketball/stockholm/
http://www.site.com/sports/basketball/malmo/

they should internally be something like

/ShowSportForCity.aspx?sportID=2&CityID=4
/ShowSportForCity.aspx?sportID=2&CityID=5
 

There is little recent documentation and examples on how to achieve this. Found a good blog post about it but it has a few years on its neck. http://tedgustaf.com/en/blog/2008/7/create-a-custom-url-rewrite-provider-for-episerver/.

I've successfully(?) setup a custom UrlRewriteModule and UrlRewriteProvider but thing is, when I enter my "virtual" url my breakpoint in my UrlRewriteModule hits, calling base, but never reaching my UrlRewriteProvider which is supposed to intepret /sports/basketball/stockholm/"

 

Is UrlRewriteProviders commonly used in EPi solutions or are there other more commonly used ways for achiving the same goals?

 

#57472
Mar 15, 2012 15:01
Vote:
 

Hi,

Have you registered your rewriter in episerver.config?

Url rewriter is the way to go.

I guess this is just an example "/ShowSportForCity.aspx?sportID=2&CityID=4"? Id and other EPiServer parameters is missing in the url.

Here is an example to a working rewriter for a blog page http://www.dodavinkeln.se/post/2012/03/15/Url-rewriter-for-a-blog.aspx

#57481
Mar 15, 2012 16:38
Vote:
 

Thanks for the quick reply and thanks for the example code.

So TryConvertToInternal was the key, here we go!

ps. yupp, registered in configs and everything but somehow .. I didnt get TryConvertToInternal to trigger. My fault I guess :)
ps2. yeah, just an example. some epi-params were missing.

#57550
Mar 20, 2012 10:41
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.