首先如果只是直接將access數據庫的後綴名改為asp是無法防止下載的正確的做法是建立一個表為這個表中寫入二進制文件即OLE對象具體代碼如下:
<%
Dim DB
RS
SQL
DB = "DB
asp" ’這裡改成你的數據庫
後綴一定要是asp
Set Conn = Server
CreateObject("Adodb
Connection")
Conn
Open "Provider=Microsoft
Jet
OLEDB
;Data Source="&Server
MapPath(db)
Conn
Execute("Create Table NotDownload(NotDown OLEObject)")
Set RS = Server
CreateObject("ADODB
RecordSet")
SQL = "Select * FROM NotDownload"
RS
Open SQL
Conn
RS
Addnew
RS("NotDown")
appendchunk(chrB(Asc("<")) & chrB(Asc("%")))
RS
Update
RS
Close
Set RS = Nothing
Conn
Close
Set Conn = Nothing
Response
Write "數據庫防下載處理完成
請確認您的Access數據庫已經改為ASP後綴"
%>
From:http://tw.wingwit.com/Article/program/net/201311/14363.html