【发布时间】:2016-12-26 07:37:27
【问题描述】:
我正在使用 HttpClient 从链接中获取数据。
这是我的回复:
#S7Z OK
#Mon Dec 26 02:26:58 EST 2016
image.anchor=168,186
image.embeddedIccProfile=0
image.embeddedPhotoshopPaths=0
image.embeddedXmpData=0
image.expiration=-1.0
image.height=373
image.iccProfile=sRGB IEC61966-2.1
image.mask=1
image.photoshopPathnames=
image.pixTyp=RGB
image.printRes=72
image.resolution=34
image.thumbRes=17
image.thumbType=2
image.timeStamp=1481737849826
image.width=336
我想将此响应转换为可访问对象。
这是我的httpclient 工作:
using (var client = getHttpClient())
{
HttpResponseMessage response = await client.GetAsync(path);
if (response.IsSuccessStatusCode)
{
//var imageData = await response.Content.ReadAsAsync<imageData>();
//imageData.timeStamp
}
else
{
//TODO: Need to handle error scenario
}
}
我添加了 cmets 让您知道我想要做什么。实际上,我想从响应中获取image.timeStamp 值。
谢谢!
【问题讨论】:
标签: c# asp.net asp.net-web-api httpclient