asp.net-mvc – 已经使用相同的参数类型定义了一个名为“Create”的成员
发布时间:2021-03-30 23:23:33 所属栏目: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.config
- ASP.NET批量下载文件的方法
- asp.net-mvc – 从Api控制器内生成绝对的url to action
- asp.net – [DataType(DataType.EmailAddress)]和[EmailAdd
- asp.net – Visual Studio – 为什么.ASPX文件比.ASPX.CS文
- 在ASP.NET中,获取基本UR1请求的最快方法是什么?
- 在ASP.Net中防止SQL注入
- asp.net – App Settings和connectionStrings配置设置中连接
- ASP.NET通过分布式Session提升性能
- 你如何获得asp.net控件的自动生成的name属性?
推荐文章
站长推荐
- asp.net-mvc-3 – MVC 3 – Html.EditorFor似乎缓
- ASP.NET AJAX中的$create函数是什么?
- asp.net-mvc – MVC导航到不同的控制器视图
- asp.net-mvc-4 – Can Castle Windsor可用于在AS
- [转]谈谈技术原则,技术学习方法,代码阅读及其它
- asp.net – 请求URL在IIS 7中无效
- C# 中的委托和事件 [转载]
- asp.net-mvc – DotNetOpenAuth在ASP.NET MVC中的
- 什么OverrideAuthenticationAttribute是为什么?
- asp.net – 当绑定值包含冒号时,如何绑定GridVie
热点阅读
