Search code examples
asp.net-mvcasp.net-mvc-3asp.net-mvc-routing

Send parameter to Home controller Index action?


What my requirement is; if I type www.mysite.com - it will load the front page. But if I type www.mysite.com/john - it will return john's profile page.

John's profile is originally located in /Profile/John and this works fine. But the requirement is www.mysite.dom/John.

I am trying many ways with NO success. Would be nice if anyone can help me out. cheers


Solution

  • Define two routes.

    First to "/Profile/{name}", then to "/{name}", pointing to the same action.