asp文件下载
<%
If Not IsNull(Request("fileName")) Then r = DownLoadFile(Request("fileName"))
Function DownLoadFile(fileName)
Dim s,fso,f,fLen
fileName = Server.MapPath(fileName)
'create stream
Set s = Server.CreateObject("ADODB.Stream")
s.Open()
s.Type = 1
Set fso = Server.CreateObject("Scripting.FileSystemObject")
If Not fso.FileExists(fileName) Then Response.Write "文件不存在" : Response.End
Set f = fso.GetFile(fileName)
fLen = f.Size
s.LoadfromFile(fileName)
'clear the buffer
Response.Buffer = True
Response.Clear()
Response.AddHeader"Content-Disposition","attachment;filename=" & f.name
Response.AddHeader"Content-Length",fLen
Response.CharSet = "UTF-8"
Response.ContentType = "application/octet-stream"
'output the file to the browser
Response.BinaryWrite s.Read
Response.Flush
s.Close
Set s = Nothing
Set fso = Nothing
End Function
%>
相关文档:
ASP的DES加密解密
2007-05-18 09:49
原文:http://hi.baidu.com/myfav/blog/item/3ebc58828edd79a30cf4d290.html
前两天学到对称密码DES算法,然后就自己亲手写了个实现程序出来,好多地方用得着呐。这里是用ASP实现,当然也就是可以移到VB啦。懂得怎样写后写成什么语言都行啦,只要懂得那门语言。如果有朋友想知道具体D ......
<%
dim db
set db=Server.CreateObject("Adodb.Connection")
db.Open "Driver={Microsoft Access Driver (*.mdb)};Dbq=" & Server.Mappath("../mdb/count.mdb")
dim strSql,rs,visitNum
strSql="Select visitNum from counter "
SET rs=db.Execute(strSql)
if session("agai ......
今天在用utf-8编码用在新的网站上,不想问题还真多,所以找了些文章,帖子,看了看,等下有用的就贴下面了。
今天,我开始把 CODEPAGE="936" 改成 CODEPAGE="65001"
把charset=gb2312改成 charset=utf-8
可是还是乱码,只要是脚本用的地方还是乱码,现在终于找到问题了,就是当脚本输出时候,要以utf-8编码输出。
就是 ......
<%
Function getHTTPPage(url)
On Error Resume Next
dim http
set http=Server.createobject("Microsoft.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312")
set http=not ......