asp.net-mvc – 已经使用相同的参数类型定义了一个名为“Create”的成员
发布时间:2021-03-31 04:44:07 所属栏目: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 AJAX应用程序?
- asp.net-mvc – 值不能为空或为空.参数名称:contentPath
- asp.net – MVC4 – ContextDependentView – 这是什么意思
- asp.net – ASP MVC – 默认的HTTP标头有任何常量吗?
- asp.net – 请求URL在IIS 7中无效
- asp.net-mvc – 使用与本地化更改冲突的自定义数据注释进行
- ASP.NET对txt文件相关操作(读
- ASP.NET 2.0和4.0似乎在Forms身份验证中以不同方式处理根UR
- ASP.NET虚拟路径映射到另一个不允许的应用程序
- asp.net读取磁盘文件、删除实例代码
推荐文章
站长推荐
- asp.net Ajax之无刷新评论介绍
- asp.net 自动将汉字转换成拼音第一个字母
- asp.net-web-api – WebAPI中的长时间运行任务
- asp.net-mvc-4 – 表单身份验证:角色(MVC 4)C#
- asp.net中一个linq分页实现代码
- 从Asp.Net MVC 6 API返回JSON错误
- asp.net – MVC4 – ContextDependentView – 这
- asp.net-mvc – ASP.NET MVC3中的随机会话超时
- asp.net – 获得“System.Web.Mvc.Html.MvcForm”
- asp.net-mvc – ASP.NET Web Api – 将对象发布到
热点阅读
