The physical path of this file is:
d:\web\localuser\godt-nok.dk\public_html\Asp24hSamples\Ch12\Listing12Exercise.asp
The ASP code of this page:
<% @ LANGUAGE = VBScript %>
<% Option Explicit %>
<%
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Const TristateUseDefault = -2 ' Opens the file using the system default.
Const TristateTrue = -1 ' Opens the file as Unicode.
Const TristateFalse = 0 ' Opens the file as ASCII.
Dim objFileSystem, objTextStream, strFile, strLine, strHTML
Set objFileSystem = Server.CreateObject("Scripting.FileSystemObject")
strFile = Server.MapPath(Request.ServerVariables("SCRIPT_NAME"))
Response.Write "The physical path of this file is:<BR>" & strFile & "<BR><BR>" & VbCrLf
Set objTextStream = objFileSystem.OpenTextFile(strFile, ForReading,TristateFalse)
Response.Write "The ASP code of this page: <BR><BR>"
Response.Write "<FONT SIZE=""-1"">"
Do While objTextStream.AtEndOfStream <> True
strLine = objTextStream.ReadLine
strHTML = Server.HTMLEncode(strLine)
strHTML = Replace(strHTML,vbTab," ")
strHTML = Replace(strHTML," "," ")
Response.Write strHTML & "<BR>" & VbCrLf
Loop
Response.Write "</FONT>"
objTextStream.Close
Set objTextStream = Nothing
Set objFileSystem = Nothing
%>