Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to implement url rewriting similar to SO

Tags:

I need to implement SO like functionality on my asp.net MVC site.

For example when user go to https://stackoverflow.com/questions/xxxxxxxx

after loading the subject line is concatenated with the url and url becomes like this https://stackoverflow.com/questions/xxxxxxxx/rails-sql-search-through-has-one-relationship

Above "/rails-sql-search-through-has-one-relationship " part is added to the url.

In webforms it's simple, I could just use url rewriting. But not sure how to accomplish this in MVC

The following line is from Global.asax file

        routes.MapRoute(
            "Default", // Route name
            "{controller}/{action}/{id}", // URL with parameters
            new { controller = "Account", action = "LogOn", id = UrlParameter.Optional } // Parameter defaults
        );

the string that I need to concatenate is in my database so it fetches from there. How can I accomplish this?