开发者

MVC Routing for domain name only

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜