Program <%
SUB printline (ByVal strLine)
Strline=server. HTMLEncode (StrLine)
Strline=replace (StrLine, "<%", "<font color= #ff0000 ><%")
Strline=replace (StrLine, "%>", "%></font>")
Strline=replace (StrLine, "<script", "<font color= #0000ff ><script", 1,-1,1)
Strline=replace (StrLine, "</SCRIPT>", "</SCRIPT></FONT>", 1,-1,1)
Strline=replace (StrLine, "<!--", "<font color= #008000 ><!--", 1,-1,1)
Strline=replace (StrLine, "-->", "--></font>", 1,-1,1)
Response.Write StrLine
End SUB
Function showcode (filename)
Dim strFileName
Dim FileObject, Oinstream, Stroutput
strFileName = filename
Set FileObject = Server.CreateObject ("Scripting.FileSystemObject")
Set Oinstream = Fileobject.opentextfile (strFileName, 1, 0, 0)
While not Oinstream.atendofstream
stroutput = Oinstream.readline
call PrintLine (stroutput)
Response.Write ("<BR>")
Wend
End Function
%>
<HTML>
<HEAD>
<title>asp Source Browser </TITLE>
</HEAD>
<body bgcolor= #FFFFFF >
<form action=viewcode.asp method=post>
Please enter ASP filename
<input type=file name=filename>
<input type=submit value= "View source program" >
</form>
<%
On Error Resume Next
Dim file
file=request.form ("filename")
Response.Write File & "source program as follows <hr>"
if trim (file) <> "" Then
call ShowCode (file)
End If
%>
</FONT>
</BODY>
</HTML>