I have a script that pulls an image from SQL Server and displays it as a link or on a page. Works perfectly in a browser and on most mobile devices. However, when linking direct开发者_开发技巧ly to the aspx file <a href="imagehandler.aspx?ImageID=123">link</a>
Android phones download the content but don't recognize the extension as an image, so they just save in the downloaded items folder as an image with an .aspx extension.
How can I cause Android devices to recognize the fileStream as an image instead of an object to be downloaded?
Thanks
I just tested a simple HTML file in the browser:
<!DOCTYPE html>
<html>
<body>
This is a test!<br/>
<a href="image.png">link</a>
</body>
</html>
When I click on the link, the image is displayed in the browser (not downloaded).
The problem must be that imagehandler.aspx
is not sending an appropriate set of headers. Maybe the script is not setting a Content-Type
header, or the wrong value, or it is sending Content-Disposition
attachment.
EDIT: This is what the browser app is getting:
精彩评论