asp.net-mvc – 已经使用相同的参数类型定义了一个名为“Create
发布时间:2020-12-15 19:44:38 所属栏目:asp.Net 来源:网络整理
导读:这个问题在这里已经有一个答案: GET and POST methods with the same Action name in the same Controller7个 我有两种方法和不同的http动词: public class ProductImageController : Controller{ [HttpGet] public ViewResult Create(int productId) { re
这个问题在这里已经有一个答案:>
GET and POST methods with the same Action name in the same Controller7个
我有两种方法和不同的http动词: public class ProductImageController : Controller { [HttpGet] public ViewResult Create(int productId) { return View(productId); } [HttpPost] public ViewResult Create(int productId) { } } 但获取错误:
解决方法
您不能在同一范围内具有相同签名的多个方法,例如相同的返回类型和参数类型.
编辑- public class ProductImageController : Controller { [HttpGet] public ViewResult Create(int productId) { return View(productId); } [HttpPost] [ActionName("Create")] public ViewResult CreatePost(int productId) { //return a View() somewhere in here } } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net-mvc – MvcMailer SendAsync阻止ASP.NET MVC请求吗
- Asp.net身份密码散列
- ASP.NET Web应用程序(.NET Framework)与ASP.NET核心Web应用
- asp.net – 引用依赖于ConfigurationManager的.net core 2中
- asp.net-mvc-3 – 为什么我的自定义HTML助手结果得到html编
- asp.net-web-api2 – 如何在Swagger中显示类属性的XML注释(
- asp.net – 在调用“WebSecurity”类的任何其他方法之前,必
- 限制访问asp.net网站的用户数量
- asp.net jquery+ajax异步刷新实现示例
- 为什么[System.ComponentModel.ToolboxItem(false)]默认来自
推荐文章
站长推荐
- asp.net – SOAP与HTTP
- asp.net-mvc – 在cshtml中折叠C#块并保存
- asp.net-mvc – 用于Bookmarked Angular SPA URL
- asp.net – 何时使用HttpApplicationState而不是
- 使用ASP.NET会话状态服务器(而不是InProc)的优点
- asp.net – 是否有可能欺骗或重用VIEWSTATE或检测
- unit-testing – 对ActionFilter进行单元测试 –
- asp.net-mvc – 我可以在发布后编辑Asp.net Mvc
- ASP.Net WCF服务的Thread.CurrentPrincipal被联邦
- ASP.net C#:如何使用File.ReadLines(fileName).
热点阅读