Say you want to write an article about ASP. How do you put ASP code in an ASP page and just display it? How do you tell the server you just want to display the code and not execute it? Here is a solution:
<%
whichfile=server.mappath("ib.asp")
Set fs = CreateObject("Scripting.FileSystemObject")
Set thisfile = fs.OpenTextFile(whichfile, 1, False)
counter=0
do while not thisfile.AtEndOfStream
counter=counter+1
thisline=thisfile.readline
response.write server.htmlencode(thisline) & "<br>"
loop
thisfile.Close
set thisfile=nothing
set fs=nothing
%>
What happens here is:
- Use the File System Object to read a line of the ASP page.
- Check if we are at the end of the page
- If not use server.htmlencode to write that line to the browser
My3C's
perrychicker
Back | Tell A Friend | Search this Site
© 1998 - 2008 psacake.com
Version 3.23
Send me One Million FREE Guaranteed Visitors