Stackoverflow.com like URLs with attribute routing in ASP.NET MVC

added by jalpesh
8/23/2014 10:56:07 AM

1 Kicks, 139 Views

Before some time I have blogged about Attribute Routing features of ASP.NET MVC 5.x version. In this blog we are going to learn how we can create stackoverflow.com like URLs with attribute routing. As you know www.stackoverflow.com is one of the most popular questions answer site where you can ask questions and almost get the answers of your questions. So to create URLs like www.stackoverflow.com we need to understand structure of URLs of Stackoverflow. Let’s take example of following question URL which I have answered on stackoverflow.com http://stackoverflow.com/questions/24133693/can-i-use-signalr-2-x-with-net-4-0-if-i-am-using-microsoft-bcl-upgrading-from and let’s take another example http://stackoverflow.com/questions/23739256/the-advantage-of-formsauthentication-class-over-session-variable If you compare and understand structure of this URLs. You will know that there will be a two things which will be dynamic for this URLS. Here 24133693 and 23739256 denotes Id of question And can-i-use-signalr-2-x-with-net-4-0-if-i-am-using-microsoft-bcl-upgrading-from and the-advantage-of-formsauthentication-class-over-session-variable part denotes the title of the question.


0 comments