ASP.NET MVC Controller与Areas下面的Controller同名的解决办法
2012-07-14 18:13
459 查看
代码
/Areas/Test/TestAreaRegistration.cs
context.MapRoute(
"Test_default",
"Test/{controller}/{action}/{id}/",
new { controller = "Home", action = "Index", id = UrlParameter.Optional },
new string[] { "Web.Areas.Test.Controllers"}
);
//Global.asax
routes.MapRoute(
"Home", // Route name
"{controller}/{action}/{id}/", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional },
new string[] { "Web.Controllers"}
);
/Areas/Test/TestAreaRegistration.cs
context.MapRoute(
"Test_default",
"Test/{controller}/{action}/{id}/",
new { controller = "Home", action = "Index", id = UrlParameter.Optional },
new string[] { "Web.Areas.Test.Controllers"}
);
//Global.asax
routes.MapRoute(
"Home", // Route name
"{controller}/{action}/{id}/", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional },
new string[] { "Web.Controllers"}
);
相关文章推荐
- ASP.NET MVC Controller与Areas下面的Controller同名的解决办法
- ASP.NET MVC下面的Controller与Fckeditor.Controllers.HomeController同名的解决办法
- ASP.NET MVC 相同Controller的解决办法
- ASP.NET MVC 返回JsonResult序列化内容超出最大限制报错的解决办法
- Asp.Net MVC Html.TextBoxFor日期格式化出错“模板只能用于字段访问、属性访问、一维数组索引或单参数自定义索引器表达式” 解决办法
- ASP.NET MVC 4 WebAPI. Support Areas in HttpControllerSelector
- Asp.net MVC @Html.DisplayNameFor中文乱码解决办法
- asp.net mvc放在iis7.5中提示404错误 js异步请求失效解决办法
- ASP.NET MVC在IIS7下发布无法显示的解决办法
- ASP.NET MVC 3 RC2 版本的一些新特性及AllowHtml属性Bug解决办法
- ASP.NET MVC 程序 报错“CS0012: 类型“System.Data.Objects.DataClasses.EntityObject”在未被引用的程序集中定义”的解决办法
- 使用Asp.net MVC 2.0 +.NET 4.0 出现 “从客户端 ... 中检测到有潜在危险的 Request.Form 值”错误的解决办法
- ASP.NET MVC引用最新Newtonsoft.Json的异常问题解决办法
- ASP.NET MVC 解决区域和全局控制器同名的问题
- asp.net MVC Controller之间解决丢失Cookie
- asp.net mvc Ajax.BeginForm不能异步刷新,或转到新页面,或页面还是刷新了,的原因(或解决办法)
- ASP.NET MVC 使用jquery.form.js 异步上传 在IE下返回值被变为下载的解决办法
- asp.net mvc在添加视图时候看不到模型类的解决办法
- Asp.net MVC 3 Razor 视图引擎 中使用@输出的内容都会被自动进行HTML编码 问题的解决办法
- ASP.NET MVC 解决区域和全局控制器同名的问题