I have an URL like this: http://website.com/Profile/Member/34
I need this URL runs like this: http://website.com/Profile/John
Given John as profile name for the user id=34.
Can anyone give me directions to do that?
I have an URL like this: http://website.com/Profile/Member/34
I need this URL runs like this: http://website.com/Profile/John
Given John as profile name for the user id=34.
Can anyone give me directions to do that?
In global.asx you need to add a new route.
You will still need to implement the action that handles looking up the profile based on {member}.
You have to add a custom route in the global.ascx.cs that will be used to redirect to the good controller. But I guess that "John" is not a unique value so you will have to keep the id in the Url, or if John is the username and is unique you can go with this url:
Then in your controller you will have :
If "John" is not a unique value I suggest you use :
So your Url will look like http://website.com/Profile/John/34 and youre controller :
Let me know if you need more help!