asp.net-mvc – 已经使用相同的参数类型定义了一个名为“Create”的成员
发布时间:2021-03-30 23:44:02 所属栏目: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成员:拒绝用户阻止CSS,页面无法正确呈现
- asp.net – 增加IIS7 / Win7 Pro上的最大上传文件
- 如何在asp.net中更改javascript警告框的标题?
- asp.net-mvc-3 – 将数组传递给RouteValues,并将
- asp.net中利用Jquery+Ajax+Json实现无刷新分页的
- asp.net-mvc – 删除布局将默认为_ViewStart,为什
- 在ASP.Net网站上使用WCF服务的教程?
- asp.net-web-api – Web API / MVC 6中的安全JSO
- 如何为Asp.Net中的所有子文件夹注册HttpHandler?
- asp.net字符串分割函数使用方法分享
热点阅读
