Response.ContentType = "image/gif"
The default behavior for MIME types is to open the document in Microsoft Internet Explorer. Adding the following code prompts the user to save the file or open the file with the associated program:
Content-disposition: attachment; filename=fname.ext
- Create a new ASP page, and paste the following code in the page:
<%@ Language=VBScript %>
Response.ContentType = "image/jpeg"
' Uncomment to prompt user for download or run with associated program.
' Response.AddHeader "content-disposition","attachment;filename=ReadMe.jpg"
Set objHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP")
' Point to an image file with adequate access permissions granted
objHTTP.open "GET", "http://servername/picture.jpg",false
Set objHTTP = Nothing
- Save the file to the Web server.
- Browse to the file.
- Due to threading issues, the ASP page and the file that is being accessed should be in different virtual folders.
- MSXML 3.0 parser or later should be installed on the server and the proxy configuration utility should be run with appropriate settings. For more information, see the "References" section.
Id. de artículo: 303982 - Última revisión: 23 mar. 2009 - Revisión: 1