指定客户端得到的图片名字,

比如用ie访问api,得到的是一个名叫 getimage 的文件,而不是XXX.jpg

ContentDispositionHeaderValue d = new

ContentDispositionHeaderValue("attachment");  #Inline是直接显示,attachment是附件下载

d.FileName = "123.jpg";

result.Content.Headers.ContentDisposition = d;

就可以指定文件名了

 

参考网站:

http://stackoverflow.com/questions/12467546/is-there-a-recommended-way-to-return-an-image-using-asp-net-web-api

http://social.msdn.microsoft.com/Forums/wpapps/zh-CN/974f10e6-f705-43b5-a171-698065dac2f2/mvc4-webapi

相关文章:

  • 2022-12-23
  • 2021-10-04
  • 2021-08-29
  • 2022-12-23
  • 2022-12-23
  • 2021-08-09
  • 2022-12-23
  • 2021-10-16
猜你喜欢
  • 2022-12-23
  • 2021-12-02
  • 2022-12-23
  • 2021-09-20
  • 2022-12-23
  • 2022-12-23
  • 2021-08-24
相关资源
相似解决方案