<%
Session("abc")="黎明"
%>
<font color=“red”><%=request("love")%></font>岁了!
<a href="5-4.asp?name=小不点&like=不学习">显示相关信息</a></p>
<%
Response.Write"你的名字为:"+Request.QueryString ("name") + "<br>"
Response.Write"你的爱好是:"+Request.QueryString ("like") + "<br>"
%>
<%Response.Write(Server.HTMLEncode("<b>请注意:</b><p> 该字符串中含有HTML标记,浏览器会将其直接输出。"))%>
<% if request.form("select")=1 then
Response.Redirect "5-1.asp"
end if
%>
<%
stringmsg="下面是由response.flush输出的文字"
Response.Write mid(stringmsg,2,10) //显示10个从第2位字符开起
%>
<br>详细住址: <%=request("address")%>
计数器
<%
application.lock()
application("count")=application("count")+1
application.unlock()
%>
写入Cookies
<%
response.cookies("user")("name")="lele"
response.cookies("user")("pass")="good"
%>
<style type="text/css">
<!--
.style1 {
color: #FF00FF;
font-size: large;
}
-->
</style>
<span class="style1">写入Cookies</span>
<h2>读出Cookies<br>
<%=Request.Cookies("user")%>
<br>
<%=Request.Cookies("user")("name")%>
<br>a
<%=Request.Cookies("user")("pass")%></h2>
在线人数:
<%@ Language="VBScript"%>
<%Response.Write"现在有"&Application("who")&"人在线"%>
global.asa
<script language="Jscript" runat="server">
function Application_OnStart()
{ Application.Lock();
Application("who")=0;
Application.UnLock();
}
function Session_OnStart()
{ Application.Lock();
Application("who")=Application("who")+1;
Application.UnLock();
}
function Session_OnEnd()
{ Application.Lock();
Application("who")=Application("who")-1
Application.Unlock();
}
</script>
读取text.txt
<%
set fs=Server.CreateObject("Scripting.FileSystemObject")
set TextFile=fs.OpenTextFile(Server.MapPath("test.txt"))
While not TextFile.AtEndOfStream //all内容|
Response.Write TextFile.ReadLine //1行 !
Response.Write"<br>"
Wend
TextFile.Close
%>
复制test名为test.bak
<%
set fs=server.createobject("scripting.filesystemobject")
fs.CopyFile server.mappath("test.txt"),server.mappath("test.bak.txt")
%>
<%
Set fs=server.createobject("Scripting.FileSystemObject")
fs.movefile server.mappath("test.bak.txt"),server.mappath("/test.bak.txt")
%>
<%
Set fs=server.createobject("Scripting.filesystemobject")
fs.deletefile server.mappath("/test.bak.txt")
%>
搜索
<%
set fs=server.createobject("scripting.filesystemobject")
if fs.fileexists(server.mappath("test.bak.txt")) then
response.write "文件存在!"
else
response.write "文件不存在!"
end if
%>
显示list
<%
set fs=Server.CreateObject("scripting.filesystemobject")
set folder=fs.GetFolder(Server.MapPath("./"))
for each file in folder.Files
%>
<br>
<a href="<%=file.name%>"><%=file.name%></a>
<%
next
%>
本路径建su...文本
<%
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set textfile=fs.CreateTextFile(Server.MapPath("./survey.txt"))
textfile.Close
%>
本路径写入su...文本
<%
source=trim(Request("source"))
rate=trim(Request("rate"))
set fs=Server.CreateObject("Scripting.FileSystemObject")
set textfile=fs.OpenTextFile(Server.MapPath("./survey.txt"),8,true)
textfile.WriteLine"=============" //line为回车
textfile.WriteLine"source="&source
textfile.WriteLine"rating="&rate
textfile.Close
%>
本路径读取su...文本
<%
set fs=server.createobject("scripting.filesystemobject")
set textfile=fs.opentextfile(server.mappath("./survey.txt"))
while not textfile.atendofstream
response.write textfile.readline //每X行显示
response.write "<br>"
wend
textfile.close
%>