I have some project management system. If I want to open project with id=123
I redirect to controller action using address:
http://myhost:67845/Projects/id=123
How I can use user-friendly link for the same action like:
http://myhost:67845/Projects/John-can-develop-asp-net-site-for-you
By using the default routing, you can use http://myhost:67845/Projects/123
without any change, since 123 will be treated as id.
However, if you want that kind of friendly name, you have to make a change in your controller.
In the second case, in your Projects controller (for default routing) this will be handled by the method called Index. This method should have a property string id
.
Then inside your method, you need a way to convert between John-can-develop-asp-net-site-for-you
and 123. This can either be that John-can-develop-asp-net-site-for-you is the name of project 123, or you will have to store the friendly name in the database as well to make the conversion.