公  告
 
  站点日历
 
  日志分类
 
  最新日志
 
  最新评论
 
  最新留言
 
  用户登陆
 
  日志搜索
 
  统计信息
 

  友情连接
 
  利用数据库实现ASP页面等待及Microsoft.XMLHTTP下载文件
[ 2006-7-8 13:06:51 | By: myfamily ]
 
 

1、等待功能

<%
Response.ExpiresAbsolute = Now() - 1 
Response.Expires = 0 
Response.CacheControl = "no-cache"
Response.Buffer =true
connstr="Provider=SQLOLEDB;Server=**;uid=**;pwd=**;database=**;autotranslate=no;" 
Set conn = CreateObject("ADODB.Connection")
conn.Open connstr
sleep = 5   '5秒
Response.Write "等候"&sleep&"再显示!"
Response.Flush
sql = "WAITFOR DELAY '00:00:0"  & sleep & "'"
conn.Execute sql,,129 
conn.Close   
Set conn = Nothing     
Response.Write "<BR>时间到!"
%>

2、自动下载

<%
Response.Buffer = True
  Dim objXMLHTTP, xml
  Set xml = Server.CreateObject("Microsoft.XMLHTTP")
 
  xml.Open "GET", _
      "
http://www.4guysfromrolla.com/webtech/code/mitchell-pres.zip", _
      False

  xml.Send
 
  ' Add a header to give it a file name:
  Response.AddHeader "Content-Disposition", _
                     "attachment;filename=mitchell-pres.zip"
 
  ' Specify the content type to tell the browser what to do:
  Response.ContentType = "application/zip"
 
  ' Binarywrite the bytes to the browser
  Response.BinaryWrite xml.responseBody

  Set xml = Nothing

%>

 

 

 

 

发表评论:

    昵称:
    密码: (游客无须输入密码)
    主页:
    标题:
 
 
 
Powered by Oblog.