asp.net-mvc – 已经使用相同的参数类型定义了一个名为“Create”的成员
发布时间:2021-03-31 02:23:11 所属栏目:asp.Net 来源:互联网
导读:这个问题在这里已经有一个答案: GET and POST methods with the same Action name in the same Controller7个 我有两种方法和不同的http动词: public class ProductImageControll
这个问题在这里已经有一个答案:>
GET and POST methods with the same Action name in the same Controller7个
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 – 为一个MVC视图使用两个强类型模型
- asp.net – 使用AJAX进行WCF调用
- 有没有办法将内部控件放在ASP.NET自定义控件中?
- asp.net-mvc – 使用没有ORM的ASP.NET MVC
- 我可以使用ASP.NET成员身份实体框架吗?
- asp.net core 实现一个简单的仓储的方法
- 什么是在asp.net中301重定向更推荐的方法?
- asp.net-mvc – mvc razor @helper可以返回非编码标签吗?
- asp.net-mvc – ASP.NET MVC身份默认实现
- asp.net-mvc – 将List参数传递到ASP.NET MVC3中的自定义操
推荐文章
站长推荐
- asp.net – FormsAuthentication.GetRedirectUrl
- ASP.NET自带对象JSON字符串与实体类的转换
- asp.net-mvc – 具有ASP.NET MVC的多语言网站
- Asp.NetCore1.1版本去掉project.json后如何打包生
- asp.net – 是否有可能过滤SignalR中的接收器?
- 什么是使用aspnet_compiler.exe预编译ASP.NET项目
- asp.net – WebBrowsable vs个性化Web部件
- asp.net-mvc-3 – 如何从ASP.NET MVC#输出中删除
- asp.net-mvc – ASP.NET MVC:部分知道它是否是从
- asp.net – OutOfMemoryException当发送大文件50
热点阅读