有关于ASP进行二进制数据处理的问题!!请进!

需要达到的目标:成功的将二进制数据串或十六进制数据串使用BinaryWrite传送给浏览器!

请给出具体的实现方法,一旦方法通过,将再给一百分!此表感谢!!

以下,是我自己写的一个例子,但有错误。:(

 1   
 2Response.buffer = TRUE   
 3Response.clear   
 4  
 5Response.AddHeader "Content-Disposition","attachment;filename="&"ok.txt"   
 6Response.AddHeader "Content-Length", 8   
 7Response.CharSet = "7bit"   
 8Response.ContentType = "Application/Octet-Stream"   
 9  
10dim bArray   
11dim iValue   
12bArray = Array(1,2,3,4,5,6,7,8,9,0)   
13iValue = bArray(0)   
14'Response.Write bArray(0)   
15Response.BinaryWrite bArray   
16Response.Flush   
17  

---------------------------------------------------------------

 1   
 2'Create a stream object   
 3Dim objStream   
 4Set objStream = Server.CreateObject("ADODB.Stream")   
 5  
 6'Open a GIF file   
 7objStream.Type = adTypeBinary   
 8objStream.Open   
 9objStream.LoadFromFile "D:\Inetpub\wwwroot\images\banner\dimacbanner1.gif"   
10  
11'Output the contents of the stream object   
12Response.ContentType = "image/gif"   
13Response.BinaryWrite objStream.Read   
14  
15'Clean up....   
16objStream.Close   
17Set objStream = Nothing   

你试试这个,不明白,我们再讨论。

Published At
Categories with Web编程
Tagged with
comments powered by Disqus