首页 > Web开发 > 详细

如何在.Net Mvc中让Get,Post请求访问同一个Action的方法

时间:2016-09-20 10:05:55      阅读:421      评论:0      收藏:0      [点我收藏+]
        [HttpPost]
        [ActionName("Index")]
        public ActionResult Post(Models.WeChatRequestModel model)
        {
            return Content("Post");
        }

        [HttpGet]
        [ActionName("Index")]
        public ActionResult Get(Models.WeChatRequestModel model)
        {
            return Content("Get");
        }

这种写法要比在Action中用If去判断请求类型更好

如何在.Net Mvc中让Get,Post请求访问同一个Action的方法

原文:http://www.cnblogs.com/weiweithe/p/5887522.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!