How to force asp.net MVC 2 to redirect to default controller/action

Posted by Chris on Stack Overflow See other posts from Stack Overflow or by Chris
Published on 2010-06-09T16:25:59Z Indexed on 2010/06/15 3:32 UTC
Read the original article Hit count: 350

In a brand new ASP.NET MVC2 project, I want the user to be redirected to

http://<mysite>/home/index 

rather than

http://<mysite>/

We do this with our other sites for tracking purposes, to avoid the scenario where hits to the same default page show up as

http://<mysite>/
http://<mysite>/default.aspx

How do I accomplish this so that http://<mysite>/ automatically redirects to whatever default controller/action I have set up in my routing? Please note that I am aware the two are functionally equivalent, as the default controller action will be executed either way. I'm just interested in forcing consistent URLs in the browser.

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about asp.net-mvc-routing