您的位置:首页 > 编程语言 > ASP

Asp.net MVC 2 使用Areas功能的常见错误

2010-06-13 00:09 459 查看
开发工具:VS2010中文旗舰版

出错的信息:

代码

public override void RegisterArea(AreaRegistrationContext context)
{
//context.MapRoute(
// "Web_default",
// "Web/{controller}/{action}/{id}",
// new { controller = "Home", action = "Index", id = UrlParameter.Optional }
//);

//直接将命名空间传入
context.MapRoute(
"Web_default",
"Web/{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional },
new string[] { "MvcApplication1.Areas.Web.Controllers" }
);

}

OK,结束了,希望大家多多交流!

可成功运行的源码Demo下载:/Files/taven/MvcApplication1.rar
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: