Response. ContentType controls the output file type (discussing the problem of downloading files)

Source: Internet
Author: User
The data packet sent from the server to the client can be text/html or gif/jpeg image files. Therefore, before each transmission, we must inform the client of the file type to be transmitted, generally, it is of the "Text/Html" type by default.
<% Response. ContentType = "text/HTML" %>
<% Response. ContentType = "image/GIF" %>
<% Response. ContentType = "image/JPEG" %>
<% Response. ContentType = "text/plain" %>
<% Response. ContentType = "image/JPEG" %>
<% Response. ContentType = "application/x-cdf" %>
Used to return text content rather than interpreted HTML statements
Response. ContentType = "text/plain"
<%
Response. ContentType = "text/plain"
Will Response. write (now () & "be executed? ")
%>

You can note that the page provides download, and the ASP content on the page is interpreted and executed.
Program files are provided for download as XLS files
Response. ContentType = "application/vnd. ms-excel"
<%
Response. ContentType = "application/vnd. ms-excel"
Response. write ("the download dialog box is displayed for debugging on this page. The Save type is XLS ")
%>

Achieve continuous playing of songs
Response. ContentType = "audio/x-pn-realaudio"
<%
Dim ramstr
Ramstr = ""
Set rs = server. createobject ("adodb. recordset ")
SQL = "XXXXXXXXXXX"
Rs. open SQL, conn, 1, 3 'conn defined
Do while not rs. eof
Ramstr = ramstr & rs ("url") & vbCrLf
Rs. movenext
Loop
Rs. close
Response. ContentType = "audio/x-pn-realaudio"
'Response. ContentType = "audio/x-mpegurl"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.