asp伪静态代码
<%
DirName="html\" '静态文件保存的目录,结尾应带"\"
foxrax=Request("foxrax")
if foxrax="" then
FileName=GetStr()&".html"
FileName=replace(FileName,"/","")'替换字符
FileName=replace(FileName,"?","")
FileName=replace(FileName,"\","")
FileName=DirName&FileName
if tesfold(DirName)=false then
createfold(Server.MapPath(".")&"\"&DirName)
end if
if ReportFileStatus(Server.MapPath(".")&"\"&FileName)=true then'文件存在
List=ReadFile(FileName)
else'文件不存在的话
List=getHTTPPage(GetUrl())
WriteFile(FileName)
end if
'Lists=split(List,"!@#$%")
'Response.write Lists(0)
'Response.end
end if
'========================函数区============================
'获取当前页面url
Function GetStr()
On Error Resume Next
Dim strTemps
strTemps = strTemps & Request.ServerVariables("URL")
If Trim(Request.QueryString) <> "" Then
strTemps = strTemps & "?" & Trim(Request.QueryString)
else
strTemps = strTemps
end if
GetStr = strTemps
End Function
'获取缓存页面url
Function GetUrl()
On Error Resume Next
Dim strTemp
If LCase(Request.ServerVariables("HTTPS")) = "off" Then
strTemp = "http://"
Else
strTemp = "https://"
End If
strTemp = strTemp & Request.ServerVariables("SERVER_NAME")
If Request.ServerVariables("SERVER_PORT") <> 80 Then
strTemp = strTemp & ":" & Request.ServerVariables("SERVER_PORT")
end if
strTemp = strTemp & Request.ServerVariables("URL")
If Trim(Request.QueryString) <> "" Then
strTemp = strTemp & "?" & Trim(Request.QueryString) & "&foxrax=foxrax"
else
strTemp = strTemp & "?" &
相关文档:
在网上看到很多这方面的代码,但是有些是不能用,有些是垃圾代码太多,我简单的修改了一下现在与大家共享一下。
<%
Option Explicit
dim databasename '定义数据库名称
databasename="database.mdb" '数据库名称
dim databasepath '定义数据库存放路径
......
功能作用:ASP产生不重复的随机数(模拟游戏洗牌)
<%
function GetRnd(lowerNum,upperNum)
Dim unit,RndNum,Fun_X
unit = upperNum - lowerNum
Redim MyArray(unit)
For Fun_I=0 To unit
myArray(Fun_I)= lowerNum + Fun_I
Next
For Fun_I=0 To round(unit)
RndNum ......
asp 中常用的文件处理函数 收藏
asp 中处理文件上传以及删除时常用的自定义函数
<%
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'所有自定义的VBS函数
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
function DeleteFile(Filename) '删除文件
&nbs ......
'函数名:GetMyTimeNumber()
'作 用:生成时间的整数
'参 数:lx ---- 时间整数的类型
' lx=0 到分钟 lx=1 到小时 lx=2 到天 lx=3 到月
'返回值:生成时间的整数值(最小到分钟)
'示 例:
'********************************* ......