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 & "?" &
相关文档:
<html xmlns="http://www.w3.org/1999/xhtml" >
<HEAD>
<title>多文件上传 </title>
<script language="JavaScript">
function addFile()
{
var str = ' <br / ......
调试程序和做程序的时候,好多重复的代码一直输入很麻烦,也很没有效率,封装一个自己的Asp包包,挺有有的
下载个精简版的VB6.0,新建 ActiveX dll,以下是封装的代码,重要部分都有注释,不懂可以跟帖
Option Explicit
Public Resp As Response, Requ As Request, Appl As Application, Serv As Server, Sess As Sessio ......
在网上看到很多这方面的代码,但是有些是不能用,有些是垃圾代码太多,我简单的修改了一下现在与大家共享一下。
<%
Option Explicit
dim databasename '定义数据库名称
databasename="database.mdb" '数据库名称
dim databasepath '定义数据库存放路径
......
Active Server Pages 提供内建对象,这些对象使用户更容易收集通过浏览器请求发送的信息、响应浏览器以及存储用户信息(如用户首选项)。本文简要说明每一个对象。
Application 对象
可以使用 Application 对象使给定应用程序的所有用户共享信息。
Request 对象
可以使用 Request 对象访问任何用 HTTP 请 ......
功能作用: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 ......