| PostPostFileGetJsonAsyncT 方法 |
Senparc.Weixin SDK 官方教程《微信开发深度解析》已出版,支持中国开源事业,请【购买正版】!
《微信公众号+小程序》视频课程已经上线,【点击这里】学习!
NeuChar(纽插)已经上线,为开发者提供一站式跨平台管理枢纽,并可将应用入驻到 NeuChar 应用商店!新功能正在不断增加中,快来使用吧! https://www.neuchar.com
在线动态微信接口 Swagger WebApi 文档: https://weixin.senparc.com:8039
【异步方法】发起Post请求,可上传文件
命名空间:
Senparc.CO2NET.HttpUtility
程序集:
Senparc.CO2NET (在 Senparc.CO2NET.dll 中) 版本:1.4.300-preview.3.21201.4.100+9de96adf02982fcbddc436d3680e19a719e9d8b2
语法 public static Task<T> PostFileGetJsonAsync<T>(
IServiceProvider serviceProvider,
string url,
CookieContainer cookieContainer = null,
Dictionary<string, string> fileDictionary = null,
Dictionary<string, string> postDataDictionary = null,
Encoding encoding = null,
X509Certificate2 cer = null,
bool useAjax = false,
Action<string, string> afterReturnText = null,
int timeOut = 10000
)
Public Shared Function PostFileGetJsonAsync(Of T) (
serviceProvider As IServiceProvider,
url As String,
Optional cookieContainer As CookieContainer = Nothing,
Optional fileDictionary As Dictionary(Of String, String) = Nothing,
Optional postDataDictionary As Dictionary(Of String, String) = Nothing,
Optional encoding As Encoding = Nothing,
Optional cer As X509Certificate2 = Nothing,
Optional useAjax As Boolean = false,
Optional afterReturnText As Action(Of String, String) = Nothing,
Optional timeOut As Integer = 10000
) As Task(Of T)
参数
- serviceProvider
- 类型:SystemIServiceProvider
.NetCore 下的服务器提供程序,如果 .NET Framework 则保留 null - url
- 类型:SystemString
请求Url - cookieContainer (Optional)
- 类型:System.NetCookieContainer
CookieContainer,如果不需要则设为null - fileDictionary (Optional)
- 类型:System.Collections.GenericDictionaryString, String
需要Post的文件(Dictionary 的 Key=name,Value=绝对路径) - postDataDictionary (Optional)
- 类型:System.Collections.GenericDictionaryString, String
需要Post的键值对(name,value) - encoding (Optional)
- 类型:System.TextEncoding
- cer (Optional)
- 类型:System.Security.Cryptography.X509CertificatesX509Certificate2
证书,如果不需要则保留null - useAjax (Optional)
- 类型:SystemBoolean
- afterReturnText (Optional)
- 类型:SystemActionString, String
返回JSON本文,并在进行序列化之前触发,参数分别为:url、returnText - timeOut (Optional)
- 类型:SystemInt32
代理请求超时时间(毫秒)
类型参数
- T
- 返回数据类型(Json对应的实体)
返回值
类型:
TaskT参见