开发者

MVC Routing for domain name only

开发者 https://www.devze.com 2023-04-12 10:00 出处:网络
I have MVC 3 application and I want to know how to set the domain name to route to specific controller and action (without specify them), e.g.

I have MVC 3 application and I want to know how to set the domain name to route to specific controller and action (without specify them), e.g. MyDomain.com to route to controller -> Landing, action -> landing.

The application is开发者_运维问答 hosted on IIS 6.

Regards, may.


You want to change the parameter defaults in the default route in global.asax:

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

精彩评论

暂无评论...
验证码 换一张
取 消