Using ASP to implement Web page calls Doc attached Response.ContentType detail list _ Application Tips
Source: Internet
Author: User
Microsoft has an article: HTTP://SUPPORT.MICROSOFT.COM/KB/193998/ZH-CN, with Doc Read and display binary data, "How to read binary file", no test, lazy compiler DLL
ASP program:
<%
Response.buffer=true
Response.contenttype= "Application/x-msexcel"
Dim Vntstream
Set Omyobject=server.createobject ("Myobject.binread") ' This component is described later
Vntstream=omyobject.readbinfile ("C:\temp\tempxls.xls")
Response.BinaryWrite (Vntstream)
Set omyobject.nothing
Response.End
%>
Control code:
The first step: Create an ActiveX DLL Project in VB
Step Two: Change the project name to MyObject
Step Three: Change the class name to Binread
Step Fourth: Write the following code in the class module
Function Readbinfile (ByVal bfilename as String)
Dim FL as Long
Dim FileNum as Byte
Dim Binbyte () as String
FileNum = FreeFile
Open bfilename for Binary Access Read as #FileNum
FL = FileLen (bfilename)
ReDim Binbyte (FL)
Get #FileNum, Binbyte
Close #FileNum
Readbinfile = Binbyte
End Function
Fifth Step: Disk
Sixth step: Compiling
My code, I do not know why can be saved, online is not open:
ASP:Response.ContentType Detailed list
Different contenttype affect what the client sees. The default contenttype is text/html, which is the Web page format.
Code such as:
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