Showing posts from December, 2016

Slug URL in MVC

Creating a human friendly URL is one of the important goal in content management system. Recently one developer asked me this question. Like he always sees 'id' in URL in MVC application which is not human friendly. He mentioned stack-overflow example when explaining issue to me, so let’s discuss about this. Open stack-overflow page
you will be redirected to
Notice the last part in the query, this is nothing but a slug that is being added in URL all the time. Technically both URL maps to same resource. And in URL number '40956081' is unique identifier.

I hope you know Stack-Overflow is also build using ASP.NET MVC. Let's build similar slug and similar behavior in your MVC application.
First you need to configure your route as give below:
public static void RegisterRoutes(RouteCollection routes) { ro…

Popular posts from this blog

5 Ways to send data between ASP.NET Pages