<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <% Option Explicit ' ////////////////////////////////////////////////////////////////////// ' / Demonstration of how to read a file using VBScript in an ASP page. / ' / - by Chris Maunder / ' ////////////////////////////////////////////////////////////////////// Const Filename = "specials/specials.txt" ' file to read - CHANGE THIS Dim Filepath, FSO, TextStream, Contents ' Some constants Const ForReading = 1, ForWriting = 2, ForAppending = 3 Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0 ' Create a filesystem object set FSO = server.createObject("Scripting.FileSystemObject") ' Map the logical path to the physical system path Filepath = Server.MapPath(Filename) if FSO.FileExists(Filepath) Then Set TextStream = FSO.OpenTextFile(Filepath, ForReading, False, TristateUseDefault) ' Read file in one hit Contents = TextStream.ReadAll TextStream.Close Set TextStream = nothing Else Contents = "

Sorry, no specials this month...

" End If Set FSO = nothing %> Rivendell Guest House - Specials

 

Rivendell Guest House - Specials

<%=Contents%>