.net mvc 一个Action的 HttpGet 和 HttpPost
2015-09-28 11:56
615 查看
http://www.cnblogs.com/freeliver54/p/3747836.html
本文转自:http://stackoverflow.com/questions/11767911/mvc-httppost-httpget-for-action
Controller:
View:
查询调用Get
<%Html.BeginForm("ActionName", "ControllerName", FormMethod.Get);%>
<% Html.Submit("BtnSearchText","btnSearch"); %>
<%Html.EndForm();%>
保存使用Post
<%Html.BeginForm("ActionName", "ControllerName", FormMethod.Post);%>
<% Html.Submit("BtnSaveText","btnSave"); %>
<%Html.EndForm();%>
本文转自:http://stackoverflow.com/questions/11767911/mvc-httppost-httpget-for-action
Controller:
[HttpGet] public ActionResult MyMethod() { return MyMethodHandler(); } [HttpPost] [ActionName("MyMethod")] public ActionResult MyMethodPost() { return MyMethodHandler(); } private ActionResult MyMethodHandler() { // handle the get or post request return View("MyMethod"); }
View:
查询调用Get
<%Html.BeginForm("ActionName", "ControllerName", FormMethod.Get);%>
<% Html.Submit("BtnSearchText","btnSearch"); %>
<%Html.EndForm();%>
保存使用Post
<%Html.BeginForm("ActionName", "ControllerName", FormMethod.Post);%>
<% Html.Submit("BtnSaveText","btnSave"); %>
<%Html.EndForm();%>
相关文章推荐
- 简述tcp协议对http性能的影响及优化
- apache旧版本下载地址:http://archive.apache.org/dist/httpd/
- HTTP POST GET 请求区别详解
- 简述tcp协议对http性能的影响及优化
- HDU 5476 Explore Track of Point (2015年上海赛区网络赛I题)
- okhttp maven下载地址
- 用 C# 实现 HTTP 协议多线程下载文件
- OkHttp使用教程
- nginx 配置 ssl 模块支持 https
- 使用java实现http多线程下载
- Android HTTP Content-type( Mime-Type)对照表
- Halcon学习 多层神经网络
- vim的配置文件。转自:http://www.cnblogs.com/ma6174/
- Cookie对象HttpOnly和secure属性
- Swift - 同步请求获取网络数据
- tomcat https 配置
- HTTP客户端向其他网站请求数据
- linux复制,网络报错
- 网络爬虫
- HDU 5491 The Next (2015年合肥赛区网络赛H题)