Using xclient As HttpClient = New HttpClient() Dim fdict As New Dictionary(Of String, Object) Dim content3 As StreamContent = New StreamContent(New FileStream(context.Server.MapPath(“/youzan.jpg”), FileMode.Open)) fdict.Add(“image”, content3) Dim content As HttpContent = New StringContent(JsonConvert.SerializeObject(fdict)) content.Headers.ContentType.MediaType = “application/json” content.Headers.ContentType.CharSet = “utf-8” ’Console.WriteLine(“Request Result—— >” + content.ReadAsStringAsync().get_Result()); Dim message As HttpResponseMessage = xclient.PostAsync(“![null]%(file:///C:\Users\apple\AppData\Local\Temp W@GJ$ACOF(TYDYECOKVDYB.png)https://open. youzanyun.com/api/youzan . materials.storage.platform.img.upload/3.0.0?access_token=” & access_token, content).Result If message.IsSuccessStatusCode Then context.Response.Write(System.Text.Encoding.UTF8.GetString(message.Content.ReadAsByteArrayAsync.Result)) Exit Sub End If End Using
Using xclient As HttpClient = New HttpClient()
Dim fdict As New Dictionary(Of String, Object)
Dim content3 As StreamContent = New StreamContent(New FileStream(context.Server.MapPath(“/youzan.jpg”), FileMode.Open))
fdict.Add(“image”, content3)
Dim content As HttpContent = New StringContent(JsonConvert.SerializeObject(fdict))
content.Headers.ContentType.MediaType = “application/json”
content.Headers.ContentType.CharSet = “utf-8”
’Console.WriteLine(“Request Result—— >” + content.ReadAsStringAsync().get_Result());
Dim message As HttpResponseMessage = xclient.PostAsync(“![null]%(file:///C:\Users\apple\AppData\Local\Temp
W@GJ$ACOF(TYDYECOKVDYB.png)https://open. youzanyun.com/api/youzan . materials.storage.platform.img.upload/3.0.0?access_token=” & access_token, content).Result
If message.IsSuccessStatusCode Then
context.Response.Write(System.Text.Encoding.UTF8.GetString(message.Content.ReadAsByteArrayAsync.Result))
Exit Sub
End If
End Using