我是靠谱客的博主 美满嚓茶,这篇文章主要介绍asp.net环境下web api接口接收参数方法,现在分享给大家,希望可以做个参考。

asp.net环境下web api接口接收参数方法

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
public static string GetRequestString(string name, string defaultValue) { string result = defaultValue; if (HttpContext.Current != null && HttpContext.Current.Request != null) { if (HttpContext.Current.Request.QueryString[name] != null || HttpContext.Current.Request.Form[name] != null) { result = HttpContext.Current.Request[name].ToString(); } } return result; } string value = RequestUtil.GetRequestString("param", "");

缺点:当参数数据量比较大时,数据会被截断,需要用下面的方法。

复制代码
1
2
3
4
5
6
7
8
[HttpPost] public bool Write([FromBody] List<StudentEntity> model) { } [HttpPost] public bool Write<T>([FromBody]T model) { }

 

这样就可以接收大量数据了。

查看原文:

http://www.cnblogs.com/zhangtingzu/p/7060518.html

转载于:https://www.cnblogs.com/zhangtingzu/p/7060518.html

最后

以上就是美满嚓茶最近收集整理的关于asp.net环境下web api接口接收参数方法的全部内容,更多相关asp.net环境下web内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(63)

评论列表共有 0 条评论

立即
投稿
返回
顶部