asp.net-mvc – 已经使用相同的参数类型定义了一个名为“Create”的成员
发布时间:2021-03-31 01:53:00 所属栏目: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 Web API
- asp.net-mvc-4 – MVC4捆绑GZIP和头文件
- asp.net-mvc-3 – 实体框架乐观并发异常未发生
- Asp.Net MVC路由表和控制器操作
- asp.net-mvc – 为什么在视图引擎中指定位置时,viewstart文
- asp.net-mvc – 为什么我在带有godaddy服务器的MVC3应用程序
- asp.net-mvc – 为什么HttpContext.Current在asp.net mvc中
- ASP.NET UpdatePanel和Javascript __dopostback
- asp.net-mvc – 程序集使用System.Web.Http 5.1,它比引用的
- vs2008试用期到期解决办法
推荐文章
站长推荐
- asp.net中一个linq分页实现代码
- ASP.NET MVC下Ajax.BeginForm方式无刷新提交表单
- asp.net-mvc – 使用没有ORM的ASP.NET MVC
- 在mvc4 asp.net中的Razor View中的模型声明
- .net – Viewstate隐藏字段如此之大,一切都会崩溃
- Asp.net core WebApi 使用Swagger生成帮助页实例
- 如何在asp.net应用程序中找到i / o瓶颈
- asp.net neatUpload 支持大文件上传组件
- 在asp.net mvc2项目中不需要MS脚本的JQuery验证
- asp.net – 来自WebHttpBinding的WCF服务中的Acc
热点阅读
