In my previous post I described the way of localization using session, but in real-world applications it's definitely not the best way of localization. Now I'll describe very simple and very powerful way of storing it in URL using routing mechanism.

Also this way of localization will not require OutputCache tricks described in previous post

The goal of this post is to show how to get URL  like this /{culture}/{Controller}/{Action}... in your application like /ru/Home/About.

Custom Route Handlers

First of all we'll need to extend standard MvcRouteHandler class.
42
About Me
About Me
My Photo
We are a team of enthusiastic developers with strong believes that

"source code can be beautiful"

"software can be 100% bug free"

"perfectness is not a feature, it's mandatory requirement"

"things are correct only if they change the world to make it better"

"nothing is impossible"

"be successful is as easy as thinking you are"

e: info(at)simplytech.co
fb: www.facebook.com/alexander.adamyan
t: +(37455)520005
a: Proshyan 2/1, Yerevan, Armenia, 0010
Blog Archive
Labels
Loading