T4MVC:URL中的区域名称不是小写

时间:2011-03-03 13:45:31

标签: asp.net-mvc asp.net-mvc-2 t4mvc

美好的一天!

我有以下链接:

<%: Url.Action(MVC.Areas.Manage.Feedback.Index()) %>

它生成为/Manage/feedback。操作和控制器名称是小写的,但区域名称 - 不是。

我使用最新的T4MVC 2.6.43进行了这样的设置:

// Choose whether you want to include an 'Areas' token when referring to areas.
// e.g. Assume the Area is called Blog and the Controller is Post:
// - When false use MVC.Blog.Post.etc...
// - When true use MVC.Areas.Blog.Post.etc...
static bool IncludeAreasToken = true;

// If true, use lower case tokens in routes for the area, controller and action names
static bool UseLowercaseRoutes = true;

提前致谢!

1 个答案:

答案 0 :(得分:2)

啊,我的错,我应该在ManageAreaRegistration.cs

中将其更改为小写
public override void RegisterArea(AreaRegistrationContext context)
{
    context.MapRoute(
        "Manage_default",
        "manage/{controller}/{action}/{id}",
        new { action = "Index", id = UrlParameter.Optional }
    );
}