【问题标题】:change the "save image as..." name of images produced by an http handler in .net更改 .net 中 http 处理程序生成的图像的“将图像另存为...”名称
【发布时间】:2010-05-07 14:59:17
【问题描述】:

我有一系列存储在 MySQL 数据库中的图像,我使用 .NET Http 处理程序 (showImage.ashx) 显示这些图像。如果用户右键单击图像并选择“将图像另存为...”,则图像名称始终默认为“showImage.jpg”。我在数据库中保存了潜在的图像名称,有没有办法通过 http 处理程序控制图像的默认保存名称?

添加 Content-Disposition 标头是解决方案,非常感谢!

HttpContext.Current.Response.AppendHeader("Content-Disposition","filename=" + fileName + ";");

【问题讨论】:

    标签: .net image httphandler save-as


    【解决方案1】:

    You need to add a Content-Disposition header,像这样:

    Content-Disposition: filename=Something.jpg
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-09-24
      • 2011-08-17
      • 1970-01-01
      • 2011-06-04
      • 1970-01-01
      • 2016-02-13
      • 2014-06-23
      • 1970-01-01
      相关资源
      最近更新 更多