SoftwareSavant
SoftwareSavant

Reputation: 9747

I need to change my MVC2 home page to a different page

How can one go about doing that. I am betting it has something to do with the routing engine. Not sure though. I will continue to browse the interwebs...

Upvotes: 1

Views: 493

Answers (2)

vcsjones
vcsjones

Reputation: 141648

You're right, you will want to change your default route. It is in the Global.asax.cs file (by default).

The default one looks like this:

routes.MapRoute(
    "Default", // Route name
    "{controller}/{action}/{id}", // URL with parameters
    new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);

This line:

new { controller = "Home", action = "Index", id = UrlParameter.Optional }

Is the defaults. The default controller name is Home and the default action is Index. Change them to what you desire.

You can learn more about routing here.

Upvotes: 3

Nathan Ratcliff
Nathan Ratcliff

Reputation: 1502

Look at your default route. Out of the box, it will point to the index method of the home controller.

Upvotes: 0

Related Questions