OpenReadTaskAsync如何获取uri的内容类型?

时间:2016-10-03 12:59:12

标签: .net webclient contenttype

考虑.Net服务中的以下代码

public async Task<Stream> GetBlob(string url) {

   WebClient client = new WebClient();
   Stream download = await client.OpenReadTaskAsync(url);
   _operationContext.OperationCompleted += delegate
      {
          download.Close();
          download.Dispose();
      };
   return download;
}

这有效,我得到了二进制数据但没有正确的内容类型(我得到application / octet-stream,因为它应该是image / jpeg)。如何传递/获取正确的mimetype?

0 个答案:

没有答案
相关问题