I have a page that displays a post by passing its id through GET or POST.
For example:
http://www.example.com/post/viewpost?id=PostTiTle
But I want achieve this like:
http://www.example.com/post/PostTiTle
So post id should be in URL using single controller. How can I achieve this?
If you didn’t modify any of the settings default MVC routing examples should work.
Example
If your controller name is Post and your action name is ViewPost then you need to add additional route like so.