大佬教程收集整理的这篇文章主要介绍了c#mvc 3,动作重载?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
这是我的索引方法:
[ActionName("Index")] public ActionResult IndexDefault() { } [ActionName("Index")] public ActionResult IndexWithEvent(String eventName) { } [ActionName("Index")] public ActionResult IndexWithEventAndLanguage(String eventName,String languagE) { }
这不断投射:
控制器类型“CoreController”上的当前操作请求“Index”在以下操作方法之间是不明确的:
System.Web.Mvc.ActionResult IndexDefault()类型ManageMvc.Controllers.CoreController
System.Web.Mvc.ActionResult IndexWithEvent(System.String)on ManageMvc.Controllers.CoreController
System.Web.Mvc.ActionResult IndexWithEventAndLanguage(System.String,System.String)on ManageMvc.Controllers.CoreController
另外,如果可能的话,正确的路线是什么?我有这个:
routes.MapRoute( "IndexRoute",// Route name "{eventNamE}/{languagE}/Core/{action}",// URL with parameters new { controller = "Core",action = "Index",eventName = UrlParameter.optional,language = UrlParameter.optional } );
网址将如下所示:
本地主机/核心/索引
本地主机/ EVENt_name /核心/索引
本地主机/ EVENt_name /语言/核心/索引
以上是大佬教程为你收集整理的c#mvc 3,动作重载?全部内容,希望文章能够帮你解决c#mvc 3,动作重载?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。