<html>
<body>
<%
response.write("<p>")
response.write("Default Timeout is: " & Session.Timeout & " minutes.")
response.write("</p>")
Session.Timeout=30
response.write("<p>")
response.write("Timeout is now: " & Session.Timeout & " minutes.")
response.write("</p>")
%>
</body>
</html>
Server Object
<html>
<body>
<%
Set fs = Server.CreateObject("Scripting.FileSystemObject")
Set rs = fs.GetFile(Server.MapPath("demo_lastmodified.asp"))
modified = rs.DateLastModified
%>
This file was last modified on: <%response.write(modified)
Set rs = Nothing
Set fs = Nothing
%>
</body>
</html>
Open a textfile for reading
<html>
<body>
<%
Set FS = Server.CreateObject("Scripting.FileSystemObject")
Set RS = FS.OpenTextFile(Server.MapPath("text") & "TextFile.txt",1)
While not rs.AtEndOfStream
Response.Write RS.ReadLine
Response.Write("<br />")
Wend
%>
<p>
<a href="text/textfile.txt"><img border="0" src="../images/btn_view_text.gif"></a>
</p>
</body>
</html>
Home made hit counter
<%
Set FS=Server.CreateObject("Scripting.FileSystemObject")
Set RS=FS.OpenTextFile(Server.MapPath("counter.txt"), 1, False)
fcount=RS.ReadLine
RS.Close
fcount=fcount+1
'This code is disabled due to the write access security on our server:
'Set RS=FS.OpenTextFile(Server.MapPath("counter.txt"), 2, False)
'RS.Write fcount
'RS.Close
Set RS=Nothing
Set FS=Nothing
%>
<html>
<body>
<p>
This page has been visited <%=fcount%> times.
</p>
</body>
</html>
FileSystem Object
<html>
<body>
<%
Set fs=Server.CreateObject("Scripting.FileSystemObject")
If (fs.FileExists("c:winntcursors3dgarro.cur"))=true Then
Response.Write("File c:winntcursors3dgarro.cur exists.")
Else
Response.Write("File c:winntcursors3dgarro.cur does not exist.")
End If
set fs=nothing
%>
</body>
</html>
<html>
<body>
<%
Set fs=Server.CreateObject("Scripting.FileSystemObject")
If fs.FolderExists("c:temp") = true Then
Response.Write("Folder c:temp exists.")
Else
Response.Write("Folder c:temp does not exist.")
End If
set fs=nothing
%>
</body>
</html>
<html>
<body>
<%
Set fs=Server.CreateObject("Scripting.FileSystemObject")
if fs.driveexists("c:") = true then
Response.Write("Drive c: exists.")
Else
Response.Write("Drive c: does not exist.")
End If
Response.write("<br>")
if fs.driveexists("g:") = true then
Response.Write("Drive g: exists.")
Else
Response.Write("Drive g: does not exist.")
End If
set fs=nothing
%>
</body>
</html>