如何在一个asp文件中转换contenttype啊?100分求教!!!内有代码!

想在一个asp文件中转换contenttype,代码目的想先打一张存在数据库中的图片,然后打一句话。可显示出来只有图片。

 1   
 2response.contenttype="image/gif"   
 3strconn="driver={microsoft access driver (*.mdb)};dbq="&server.MapPath("alumni.mdb")   
 4Set cn = Server.CreateObject("ADODB.Connection")   
 5cn.Open strconn   
 6Set rs = cn.Execute("SELECT bin FROM z WHERE ID=13")   
 7Response.BinaryWrite rs("bin")   
 8  
 9Response.Expires = 0   
10Response.Buffer = TRUE   
11response.contenttype="text/html"   
12response.write "hi"   

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

不可以输出两个 contenttype 的。
你这样做不是更好?
a.asp

response.write "

1<img src="images.asp"/>
1<br/>

hi"

images.asp
response.contenttype="image/gif"
strconn="driver={microsoft access driver (*.mdb)};dbq="&server.MapPath("alumni.mdb")
Set cn = Server.CreateObject("ADODB.Connection")
cn.Open strconn
Set rs = cn.Execute("SELECT bin FROM z WHERE ID=13")
Response.BinaryWrite rs("bin")
---------------------------------------------------------------

不可能做到。
为什么不改成这样?

1   
2Response.Expires = 0   
3Response.Buffer = TRUE   
4response.contenttype="text/html"   
1<html>
2<body>
3<img src="tu.asp"/>   

response.write "hi"

1  
2tu.asp:   

response.contenttype="image/gif"
strconn="driver={microsoft access driver (*.mdb)};dbq="&amp;server.MapPath("alumni.mdb")
Set cn = Server.CreateObject("ADODB.Connection")
cn.Open strconn
Set rs = cn.Execute("SELECT bin FROM z WHERE ID=13")
Response.BinaryWrite rs("bin")

1\---------------------------------------------------------------   
2  
3avi video/x-ms-msvideo   
4mp3 audio/mpeg   
5mpe,mpeg video/mpeg</body></html>
Published At
Categories with Web编程
comments powered by Disqus